Skip to content

Commit 9bc23d3

Browse files
committed
fix: add x-forwarded-{port,proto} to proxyHeaderIgnore defaults (nuxt-community#462)
1 parent c6e256c commit 9bc23d3

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

docs/content/en/options.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ This also helps making consistent requests in both SSR and Client Side code.
168168

169169
## `proxyHeadersIgnore`
170170

171-
* Default `['accept', 'host', 'x-forwarded-host', 'cf-ray', 'cf-connecting-ip', 'content-length', 'content-md5', 'content-type']`
171+
* Default `['accept', 'host', 'x-forwarded-host', 'x-forwarded-port', 'x-forwarded-proto', 'cf-ray', 'cf-connecting-ip', 'content-length', 'content-md5', 'content-type']`
172172

173173
This is useful and effective only when `proxyHeaders` is set to true. It removes unwanted requests headers to the API backend in SSR.
174174

175-
Ignoring the headers `x-forwarded-host`, `cf-ray`, and `cf-connecting-ip` is necessary to avoid confusing reverse proxies (including CloudFlare) and avoid causing proxy loops.
175+
Ignoring the headers `x-forwarded-*`, `cf-ray`, and `cf-connecting-ip` is necessary to avoid confusing reverse proxies (including CloudFlare) and avoid causing proxy loops.
176176

177177
## `headers`
178178

lib/module.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,18 @@ function axiosModule (_moduleOptions) {
6464
debug: false,
6565
progress: true,
6666
proxyHeaders: true,
67-
proxyHeadersIgnore: ['accept', 'host', 'x-forwarded-host', 'cf-ray', 'cf-connecting-ip', 'content-length', 'content-md5', 'content-type'],
67+
proxyHeadersIgnore: [
68+
'accept',
69+
'cf-connecting-ip',
70+
'cf-ray',
71+
'content-length',
72+
'content-md5',
73+
'content-type',
74+
'host',
75+
'x-forwarded-host',
76+
'x-forwarded-port',
77+
'x-forwarded-prot'
78+
],
6879
proxy: false,
6980
retry: false,
7081
https,

0 commit comments

Comments
 (0)