@gasket/plugin-fastify 6.45.2 → 6.46.1-7.0.0-cli.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/lib/index.js +2 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -35,6 +35,7 @@ All the configurations for the plugin are added under `fastify` in the config:
|
|
|
35
35
|
- `compression`: true by default. Can be set to false if applying compression
|
|
36
36
|
differently.
|
|
37
37
|
- `excludedRoutesRegex`: Routes to be excluded based on a regex
|
|
38
|
+
- `trustProxy`: Enable trust proxy option, [see Fastify documentation for possible values](https://fastify.dev/docs/latest/Reference/Server/#trustproxy)
|
|
38
39
|
|
|
39
40
|
#### Example configuration
|
|
40
41
|
|
|
@@ -45,7 +46,8 @@ module.exports = {
|
|
|
45
46
|
},
|
|
46
47
|
fastify: {
|
|
47
48
|
compression: false,
|
|
48
|
-
excludedRoutesRegex: /^(?!\/_next\/)
|
|
49
|
+
excludedRoutesRegex: /^(?!\/_next\/)/,
|
|
50
|
+
trustProxy: true
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
```
|
package/lib/index.js
CHANGED
|
@@ -46,8 +46,9 @@ module.exports = {
|
|
|
46
46
|
|
|
47
47
|
const { logger, config } = gasket;
|
|
48
48
|
const { middleware: middlewareConfig } = config;
|
|
49
|
+
const trustProxy = config.fastify?.trustProxy ?? false;
|
|
49
50
|
const excludedRoutesRegex = config.fastify && config.fastify.excludedRoutesRegex;
|
|
50
|
-
const app = fastify({ logger });
|
|
51
|
+
const app = fastify({ logger, trustProxy });
|
|
51
52
|
|
|
52
53
|
// Enable middleware for fastify@3
|
|
53
54
|
await app.register(middie);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gasket/plugin-fastify",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.46.1-7.0.0-cli.6.0",
|
|
4
4
|
"description": "Adds fastify support to your application",
|
|
5
5
|
"main": "lib",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"middie": "^5.4.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@gasket/engine": "^6.
|
|
46
|
+
"@gasket/engine": "^6.46.1-7.0.0-cli.6.0",
|
|
47
47
|
"cross-env": "^7.0.3",
|
|
48
48
|
"eslint": "^8.56.0",
|
|
49
49
|
"eslint-config-godaddy": "^7.0.2",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"fastify": "^3.3.0",
|
|
54
54
|
"jest": "^29.7.0"
|
|
55
55
|
},
|
|
56
|
-
"
|
|
56
|
+
"peerDeps": {
|
|
57
57
|
"fastify": "^3.0.0"
|
|
58
58
|
},
|
|
59
59
|
"eslintConfig": {
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"eslintIgnore": [
|
|
72
72
|
"generator"
|
|
73
73
|
],
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "0d3c61e5ba470fbca7ae5e331d15e41b57410fe0"
|
|
75
75
|
}
|