Skip to content

Commit

Permalink
fix: add x-forwarded-host to proxyHeaderIgnore defaults (#462)
Browse files Browse the repository at this point in the history
resolves #456
  • Loading branch information
Hassan Selim authored Jan 4, 2021
1 parent 030b6b7 commit 433548b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions docs/content/en/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ In SSR context, this options sets client requests headers as default headers for
This is useful for making requests which need cookie based auth on server side.
This also helps making consistent requests in both SSR and Client Side code.

> **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.
## `proxyHeadersIgnore`

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

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

This is useful and efficient only when `proxyHeaders` is set to true. Removes unwanted requests headers to the API backend in SSR.
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.

## `headers`

Expand Down
2 changes: 1 addition & 1 deletion lib/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function axiosModule (_moduleOptions) {
debug: false,
progress: true,
proxyHeaders: true,
proxyHeadersIgnore: ['accept', 'host', 'cf-ray', 'cf-connecting-ip', 'content-length', 'content-md5', 'content-type'],
proxyHeadersIgnore: ['accept', 'host', 'x-forwarded-host', 'cf-ray', 'cf-connecting-ip', 'content-length', 'content-md5', 'content-type'],
proxy: false,
retry: false,
https,
Expand Down

0 comments on commit 433548b

Please sign in to comment.