Failed to determine the https port for redirect in Docker Failed to determine the https port for redirect in Docker docker docker

Failed to determine the https port for redirect in Docker


The two warnings are totally unrelated.

For the DataProtection warning, I recommend following the guidance presented here on the official ASP.Net Core documents. If you care to dig in deeper as to the relevant source code and decision, you can see this relevant ASP.Net GitHub PR.

For the https redirection warning, I recommend simply removing the https redirection policy from the startup.cs file which is typically defined via app.UseHttpsRedirection(); unless you're actually using this policy for your container and in this case you'd need to actually setup the certificates and expose the HTTPS port on your container.


This is because when you created the ASP.NET Core project you selected the option "Configure for HTTPS". This adds the HttpsRedirectionMiddleware middleware which enforces SSL connections for your web app. The docker file you created is only specifying the HTTP port. Hence the HttpsRedirectionMiddleware is failing and shutting down the application. Basically if you had not selected the "Configure for HTTPS" option while you created the project you would be fine or ensure the SSL is setup properly (ports and certs).


Your port only specifies http protocol not https you might have to find a way to have the docker to only look 80 and ignore 443 port which is for https