-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add x-forwarded-host
to proxyHeaderIgnore
defaults
#462
Conversation
This it to avoid reverse-proxy loops. Updated docs to reflect new defaults and explain the purpose of that new default.
Codecov Report
@@ Coverage Diff @@
## master #462 +/- ##
=======================================
Coverage 95.55% 95.55%
=======================================
Files 1 1
Lines 45 45
Branches 25 25
=======================================
Hits 43 43
Misses 2 2
Continue to review full report at Codecov.
|
x-forwarded-host
to proxyHeaderIgnore
defaultsx-forwarded-host
to proxyHeaderIgnore
defaults
Thanks! |
Hi, Thank you for this change, @hassanselim0; it's a good improvement, but I think it's incomplete. If you ignore I didn't have any problem with @pi0, I'll be glad to open a PR if you want. Best regards, |
@bblanchon can you elaborate more on that specific case and how it caused problems? I might have missed it as I've only tested with https on a staging environment on kubernetes (so no The scenario I'm imagining here is as follows:
This assumes Nuxt Axios mimics everything and doesn't just go from Nuxt to Backend through internal network (I don't know if such a think is possible TBH and it's probably a bad idea to skip the reverse proxy). Without Nuxt the flow is like this:
In this case the Backend Server will still get That said, I do see the value of ignoring all |
My scenario is pretty basic:
Both servers run on the same machine, so during SSR, the Nuxt server communicates with the backend server via HTTP. |
Ignoring both @hassanselim0 @bblanchon do you mind making a PR? (also in foot note, i think going to replace proxied headers with allowlist of headers in next major versions...) |
I just opened a PR. |
As mentioned in #456, some reverse proxies get confused when they get an
x-forwarded-host
and cause loops or incorrectly rewriting thehost
header. I assume the proxying of this header might also cause issues with CloudFlare.After adding this header to the ignored list my problem was fixed and I have tested the new defaults with CloudFlare reverse proxy and it's working fine.
Note: I've also updated docs to reflect new defaults and explain the purpose of that new default, and removed the note about disabling header proxying altogether when using CloudFlare since this is no longer needed thanks to this commit and previous ones that added the
cf-ray
andcf-connecting-ip
headers to that same ignore list.