Wrong HTTPS environment variable in documentation
Description
It looks like the wrong environment variable is specified in the UseHttpsRedirection and Port configuration sections of the documentation. It says to set the ASPNETCORE_HTTPS_PORTS variable, but https://github.com/aspnet/Announcements/issues/301 says to use ASPNETCORE_HTTPS_PORT (no ending 'S'). I tried both in an Azure Web App, and only the ASPNETCORE_HTTPS_PORT enforced a redirect for me.
Page URL
https://learn.microsoft.com/en-us/aspnet/core/security/enforcing-ssl?view=aspnetcore-8.0&tabs=visual-studio%2Clinux-ubuntu
Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/security/enforcing-ssl.md
Document ID
12ca0b9a-2638-a4ce-c45f-d4579c83dafb
Article author
@tdykstra
@amcasey what do you think -- everything I have found indicates the one with S on the end is correct
There's an S: https://github.com/dotnet/aspnetcore/blob/bc0ed99129fb20b2f12da93fb10d60c1812a6101/src/Hosting/Abstractions/src/WebHostDefaults.cs#L64
Wait, I've never seen that one in the middleware before. The constant I linked was added in 8.0.
Well, that's concerning: we appear to also have a no-S env var: https://github.com/dotnet/aspnetcore/blob/42af9fe6ddd7c3f9cde04ac003bf97509881873b/src/Middleware/HttpsPolicy/src/HttpsRedirectionMiddleware.cs#L127
@Tratcher were you aware of HTTPS_PORT when you added HTTPS_PORTS? Do you have any expectations around how they should interact?
Educated guess: HTTPS_PORTS means "listen on the following ports for HTTPS connections" and HTTPS_PORT means "if you get a non-HTTPS connection, redirect to this port".
Educated guess:
HTTPS_PORTSmeans "listen on the following ports for HTTPS connections" andHTTPS_PORTmeans "if you get a non-HTTPS connection, redirect to this port".
This is correct, but I can understand the confusion between them. That's what docs are for 😆.
#31538 made a number of changes from PORT to PORTS that we should revisit with this in mind to see if they need to be reverted.
@gh5692 Thanks for reporting this! It's corrected in https://github.com/dotnet/AspNetCore.Docs/pull/33489