-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
app.UseForwardedHeaders() does not use X-Forwarded headers #6005
Comments
Unlikely, this choice was explicit. The x-forwarded headers are actually pretty dangerous if not used carefully, they can lead to spoofing attacks. As such the configuration needs to be explicit. The zero-argument overload is for use with options configured in ConfigureServices rather than inline. It may make sense for the middleware to throw on startup if ForwardedHeaders is still set to None. |
Good to know. Thanks. It could be helpful to add that to the method comment.
That would work for me. |
We were also caught by this. I'd add a +1 to this suggestion:
|
I realize this API in its current iteration is a pit of failure, but we've doced the behavior and at this point do not want to introduce a breaking change. |
As @ygoe mentioned in dotnet/AspNetCore.Docs#2384 (comment), the behavior of
.UseForwardedHeaders
without arguments is unexpected and counter-intuitive. Since I was just caught by this as well, I decided to open this issue. Would it be possible to either have.UseForwardedHeaders
default toForwardedHeaders.All
or to remove the zero-argument overload of this method?Thanks,
Kevin
The text was updated successfully, but these errors were encountered: