-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Read HTTP_PORTS and HTTPS_PORTS into IServerAddresses #44194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
#nullable enable | ||
static readonly Microsoft.AspNetCore.Hosting.WebHostDefaults.HttpPortKey -> string! | ||
static readonly Microsoft.AspNetCore.Hosting.WebHostDefaults.HttpsPortKey -> string! |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,18 @@ public async Task StartAsync(CancellationToken cancellationToken) | |
urls = Options.WebHostOptions.ServerUrls; | ||
} | ||
|
||
if (string.IsNullOrEmpty(urls)) | ||
{ | ||
// HTTP_PORTS and HTTPS_PORTS, these are lower priority than Urls. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we log a warning if we ignore There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lots of warnings.......... 😄 |
||
var httpPorts = Configuration[WebHostDefaults.HttpPortKey]; | ||
var httpUrls = httpPorts?.Split(';', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries) | ||
Tratcher marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.Select(port => $"http://*:{port}").Aggregate((s1, s2) => string.Concat(s1, ";", s2)); | ||
Tratcher marked this conversation as resolved.
Show resolved
Hide resolved
Tratcher marked this conversation as resolved.
Show resolved
Hide resolved
|
||
var httpsPorts = Configuration[WebHostDefaults.HttpsPortKey]; | ||
Tratcher marked this conversation as resolved.
Show resolved
Hide resolved
|
||
var httpsUrls = httpsPorts?.Split(';', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries) | ||
.Select(port => $"https://*:{port}").Aggregate((s1, s2) => string.Concat(s1, ";", s2)); | ||
urls = string.Join(';', httpUrls, httpsUrls); | ||
Tratcher marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
if (!string.IsNullOrEmpty(urls)) | ||
{ | ||
// We support reading "preferHostingUrls" from app configuration | ||
|
Uh oh!
There was an error while loading. Please reload this page.