-
Notifications
You must be signed in to change notification settings - Fork 25.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
Setting the environment variable to enable forwarded headers needs to be more prominent #18532
Comments
Just FYI, setting this environment variable isn't required - it's for convenience so that you don't have to add both |
@serpent5 that's great information. Is it worth adding In the preceding code, setting Let me know if you'd like to add that. |
It looks like things have changed a bit since that section was written. The code sample that the reader is instructed to add is now part of the From what I see, if you're using For reference, I found the PR that made the change: #12740. It looks like it was during the transition to 3.x, so it might be worth seeing if |
Yup, these could use some updates.
|
@serpent5 would you like to PR this when you have time? |
Yeah, it's on my list. |
I just stumbled across this issue while trying to get an ASP.NET Core app using OAuth working when debugging with GitHub Codespaces and getting really confused why the redirect URLs were sending I've written this up on my blog, but maybe adding something about needing to add Specifically, with if (string.Equals(builder.Configuration["CODESPACES"], "true", StringComparison.OrdinalIgnoreCase))
{
builder.Services.Configure<ForwardedHeadersOptions>(
options => options.ForwardedHeaders |= ForwardedHeaders.XForwardedHost);
} |
While trying to get X-Forwarded-Proto header to be respected and after much frustration I noticed that in of the code sample it has
Environment.GetEnvironmentVariable("ASPNETCORE_FORWARDEDHEADERS_ENABLED")
Which led me to realise that I needed to set this environment variable in order to get it to work. Perhaps this information aught to be more prominent?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: