Skip to content

Commit 433548b

Browse files
author
Hassan Selim
authored
fix: add x-forwarded-host to proxyHeaderIgnore defaults (#462)
resolves #456
1 parent 030b6b7 commit 433548b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

docs/content/en/options.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,13 @@ In SSR context, this options sets client requests headers as default headers for
166166
This is useful for making requests which need cookie based auth on server side.
167167
This also helps making consistent requests in both SSR and Client Side code.
168168

169-
> **NOTE:** If you are directing requests to an url that is protected by CloudFlare's CDN you should set this to `false` in order to prevent CloudFlare from mistakenly detecting a reverse proxy loop and returning a 403 error.
170-
171169
## `proxyHeadersIgnore`
172170

173-
* Default `['host', 'accept', 'cf-ray', 'cf-connecting-ip', 'content-length']`
171+
* Default `['accept', 'host', 'x-forwarded-host', 'cf-ray', 'cf-connecting-ip', 'content-length', 'content-md5', 'content-type']`
172+
173+
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-
This is useful and efficient only when `proxyHeaders` is set to true. Removes unwanted requests headers to the API backend in SSR.
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.
176176

177177
## `headers`
178178

lib/module.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function axiosModule (_moduleOptions) {
6464
debug: false,
6565
progress: true,
6666
proxyHeaders: true,
67-
proxyHeadersIgnore: ['accept', 'host', 'cf-ray', 'cf-connecting-ip', 'content-length', 'content-md5', 'content-type'],
67+
proxyHeadersIgnore: ['accept', 'host', 'x-forwarded-host', 'cf-ray', 'cf-connecting-ip', 'content-length', 'content-md5', 'content-type'],
6868
proxy: false,
6969
retry: false,
7070
https,

0 commit comments

Comments
 (0)