aspnet / BasicMiddleware

[Archived] Basic middleware components for ASP.NET Core. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
169 stars 84 forks source link

`app.UseHttpsRedirection()` behind IIS #352

Closed John0King closed 5 years ago

John0King commented 6 years ago

Will ANCM automatice set ASPNETCORE_HTTPS_PORT environment variable ?

Tratcher commented 6 years ago

@shirhatti that's a good idea.

Tratcher commented 6 years ago

@John0King are you running IIS on 443 or a custom port?

shirhatti commented 6 years ago

Not sure I understand the ask here. Do you want ANCM to enforce HTTPS redirection?

John0King commented 6 years ago

@Tratcher port 443.


IIS Express with Visual Studio will set ASPNETCORE_HTTPS_PORT environment variable (so the default template work) , but running on IIS do not have this environment variable.

shirhatti commented 6 years ago

The ASP.NET Core Module that responsible for managing the lifetime of the dotnet.exe process (and capable of setting environment variables) doesn't have access to the binding information. While it's trivial to set the environment variable, we can make no guarantees that an HTTPS binding exists in IIS for the same hostname that the HTTP request was received on.

@jkotalik You got any thoughts on this?

jkotalik commented 6 years ago

Yeah I don't think there is a good way to reliably redirect to Https with IIS easily.

John0King commented 6 years ago

Then I think the default template created by visualstudio need to change, it should not only work for dev environment.

muratg commented 5 years ago

https://github.com/aspnet/IISIntegration/issues/485