Reputation: 2429
I am using cookie authentication without ASP.NET Core Identity. For unauthenticated requests, the middleware redirects the browser to a login page. The target URI of the redirect is always using the http scheme, even though the initial request is using HTTPS. I want the redirect to always use HTTPS, but I cannot figure out how to make that work.
Here is what I found so far:
How do I resolve this? Can I configure IIS to use HTTPS to communicate with Kestrel or can I just somehow force the middleware to output https-URIs?
Upvotes: 0
Views: 309
Reputation: 30046
For app.UseHttpsRedirection();
, you need to specify the HTTPS Port
.
Turn to launchSettings.json
and change the iisSettings.iisExpress.sslPort
to a valid port number like 44371
.
If you fail to launch the project after specifying the port, try to Project Property->Debug->check Enable SSL->Save
Upvotes: 0