@gasket/plugin-fastify 7.5.6 → 7.5.7
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/EXAMPLES.md +1 -1
- package/README.md +18 -2
- package/cjs/utils.cjs +4 -4
- package/package.json +6 -6
package/EXAMPLES.md
CHANGED
package/README.md
CHANGED
|
@@ -30,9 +30,25 @@ All the configurations for the plugin are added under `fastify` in the config:
|
|
|
30
30
|
|
|
31
31
|
- `compression`: true by default. Can be set to false if applying compression
|
|
32
32
|
differently.
|
|
33
|
-
- `trustProxy`: Enable trust proxy option, [see Fastify documentation for possible values](https://fastify.dev/docs/
|
|
33
|
+
- `trustProxy`: Enable trust proxy option, [see Fastify documentation for possible values](https://fastify.dev/docs/v4.29.x/Reference/Server/#trustproxy).
|
|
34
|
+
See [trustProxy](#trustproxy) below for the recommended setting.
|
|
34
35
|
- `disableRequestLogging`: Turn off request logging, true by default
|
|
35
36
|
|
|
37
|
+
#### trustProxy
|
|
38
|
+
|
|
39
|
+
Set it to the number of proxies in front of the app. `true` trusts the whole
|
|
40
|
+
`X-Forwarded-For` chain, so `request.ip` becomes whatever the client sent
|
|
41
|
+
first — any client can prepend its own entry to that header. Leave it unset
|
|
42
|
+
when nothing sits in front of the app — `request.ip` is then the socket peer.
|
|
43
|
+
|
|
44
|
+
A hop count assumes every request passes through the same number of proxies.
|
|
45
|
+
When paths vary or the app is reachable directly — for example, some traffic
|
|
46
|
+
reaches the load balancer without the CDN — a client on the shorter path
|
|
47
|
+
supplies the entry the count selects. Trust the proxies by address instead: an
|
|
48
|
+
IP or CIDR list such as `['10.0.0.0/8']`, or a function. Fastify releases newer
|
|
49
|
+
than the v4 line this plugin supports disable hop-count trust entirely, so use
|
|
50
|
+
addresses there.
|
|
51
|
+
|
|
36
52
|
#### Example configuration
|
|
37
53
|
|
|
38
54
|
```js
|
|
@@ -43,7 +59,7 @@ export default makeGasket({
|
|
|
43
59
|
fastify: {
|
|
44
60
|
compression: false,
|
|
45
61
|
excludedRoutesRegex: /^(?!\/_next\/)/,
|
|
46
|
-
trustProxy:
|
|
62
|
+
trustProxy: 1 // one load balancer in front
|
|
47
63
|
}
|
|
48
64
|
});
|
|
49
65
|
```
|
package/cjs/utils.cjs
CHANGED
|
@@ -5,17 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
alignLogger
|
|
12
|
+
get alignLogger () {
|
|
13
13
|
return alignLogger;
|
|
14
14
|
},
|
|
15
|
-
getAppInstance
|
|
15
|
+
get getAppInstance () {
|
|
16
16
|
return getAppInstance;
|
|
17
17
|
},
|
|
18
|
-
testClearAppInstance
|
|
18
|
+
get testClearAppInstance () {
|
|
19
19
|
return testClearAppInstance;
|
|
20
20
|
}
|
|
21
21
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gasket/plugin-fastify",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.7",
|
|
4
4
|
"description": "Adds fastify support to your application",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"@types/connect": "^3.4.38",
|
|
40
40
|
"fastify": "^4.29.1",
|
|
41
41
|
"vitest": "^3.2.0",
|
|
42
|
-
"@gasket/cjs": "^7.1.
|
|
43
|
-
"@gasket/core": "^7.7.
|
|
42
|
+
"@gasket/cjs": "^7.1.3",
|
|
43
|
+
"@gasket/core": "^7.7.7",
|
|
44
44
|
"@gasket/plugin-https": "^7.4.2",
|
|
45
|
-
"@gasket/plugin-logger": "^7.
|
|
46
|
-
"@gasket/plugin-metadata": "^7.5.
|
|
47
|
-
"create-gasket-app": "^7.4.
|
|
45
|
+
"@gasket/plugin-logger": "^7.5.1",
|
|
46
|
+
"@gasket/plugin-metadata": "^7.5.14",
|
|
47
|
+
"create-gasket-app": "^7.4.27"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"fastify": "^4.29.1"
|