Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/content/en/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ This also helps making consistent requests in both SSR and Client Side code.

## `proxyHeadersIgnore`

* Default `['accept', 'host', 'x-forwarded-host', 'cf-ray', 'cf-connecting-ip', 'content-length', 'content-md5', 'content-type']`
* Default `['accept', 'host', 'x-forwarded-host', 'x-forwarded-port', 'x-forwarded-proto', '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.

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.
Ignoring headers like `x-forwarded-host` is necessary to avoid confusing reverse proxies (like Nginx and CloudFlare) and avoid causing proxy loops.

## `headers`

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