Browse Source

Only add ports with http and https protocol to ASPNETCORE_URLS (#1153)

pull/1192/head
Tim Potze 5 years ago
committed by GitHub
parent
commit
f9903e237c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/Microsoft.Tye.Hosting/DockerRunner.cs
  2. 3
      src/Microsoft.Tye.Hosting/ProcessRunner.cs

3
src/Microsoft.Tye.Hosting/DockerRunner.cs

@ -242,7 +242,8 @@ namespace Microsoft.Tye.Hosting
if (docker.IsAspNet)
{
// 2. Configure ASP.NET Core to bind to those same ports
environment["ASPNETCORE_URLS"] = string.Join(";", ports.Select(p => $"{p.Protocol ?? "http"}://*:{p.ContainerPort ?? p.Port}"));
var urlPorts = ports.Where(p => p.Protocol == null || p.Protocol == "http" || p.Protocol == "https");
environment["ASPNETCORE_URLS"] = string.Join(";", urlPorts.Select(p => $"{p.Protocol ?? "http"}://*:{p.ContainerPort ?? p.Port}"));
// Set the HTTPS port for the redirect middleware
foreach (var p in ports)

3
src/Microsoft.Tye.Hosting/ProcessRunner.cs

@ -220,7 +220,8 @@ namespace Microsoft.Tye.Hosting
// These are the ports that the application should use for binding
// 1. Configure ASP.NET Core to bind to those same ports
environment["ASPNETCORE_URLS"] = string.Join(";", ports.Select(p => $"{p.Protocol ?? "http"}://{application.ContainerEngine.AspNetUrlsHost}:{p.Port}"));
var urlPorts = ports.Where(p => p.Protocol == null || p.Protocol == "http" || p.Protocol == "https");
environment["ASPNETCORE_URLS"] = string.Join(";", urlPorts.Select(p => $"{p.Protocol ?? "http"}://{application.ContainerEngine.AspNetUrlsHost}:{p.Port}"));
// Set the HTTPS port for the redirect middleware
foreach (var p in ports)

Loading…
Cancel
Save