Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to determine the https port for redirect in Docker

I'm trying to deploy an asp.net-core webapi service which is exposed from 80 port using:

docker run --rm -p 80:80 --name radicadorrest -it radicadorrest 

error:

warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35] No XML encryptor configured. Key {e60978fd-16bc-4ff2-8525-39b5d0c36be5} may be persisted to storage in unencrypted form. Hosting environment: Production Content root path: /app Now listening on: http://[::]:80 Application started. Press Ctrl+C to shut down.

warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3] Failed to determine the https port for redirect. Application is shutting down...

I have tried using different ports but I get the same error.

Docker version:

Client: Version: 17.09.1-ce
API version: 1.32
Go version: go1.8.3
Git commit: 19e2cf6
Built: Thu Dec 7 22:25:13 2017
OS/Arch: linux/amd64

Server: Version: 17.09.1-ce
API version: 1.32 (minimum version1.12)
Go version: go1.8.3
Git commit: 19e2cf6
Built: Thu Dec 7 22:26:35 2017 OS/Arch: linux/amd64 Experimental:false

I have also trying on Windows with the same result.

like image 649
juan jose perez hernandez Avatar asked Jul 17 '18 15:07

juan jose perez hernandez


1 Answers

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.

like image 57
David Tesar Avatar answered Sep 22 '22 12:09

David Tesar