Read HTTP_PORTS and HTTPS_PORTS into IServerAddresses #44194
Merged
Tratcher merged 3 commits intodotnet:mainfrom Sep 29, 2022
Merged
Read HTTP_PORTS and HTTPS_PORTS into IServerAddresses #44194Tratcher merged 3 commits intodotnet:mainfrom
Tratcher merged 3 commits intodotnet:mainfrom
Conversation
JamesNK
reviewed
Sep 27, 2022
JamesNK
reviewed
Sep 27, 2022
JamesNK
reviewed
Sep 27, 2022
JamesNK
reviewed
Sep 27, 2022
davidfowl
reviewed
Sep 27, 2022
JamesNK
approved these changes
Sep 27, 2022
halter73
reviewed
Sep 28, 2022
|
|
||
| if (string.IsNullOrEmpty(urls)) | ||
| { | ||
| // HTTP_PORTS and HTTPS_PORTS, these are lower priority than Urls. |
Member
There was a problem hiding this comment.
Can we log a warning if we ignore HTTP_PORTS and/or HTTPS_PORTS becuase URLS is set?
Member
Author
There was a problem hiding this comment.
warn: Microsoft.AspNetCore.Hosting.Diagnostics[15]
Overriding HTTP_PORTS '5002' and HTTPS_PORTS ''. Binding to values defined by URLS instead 'http://*:5003'.
warn: Microsoft.AspNetCore.Server.Kestrel[0]
Overriding address(es) 'http://*:5003'. Binding to endpoints defined via IConfiguration and/or UseKestrel() instead.
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://[::]:5004
|
@Tratcher, this change will be considered for inclusion in the blog post for the release it'll ship in. Nice work! Please ensure that the original comment in this thread contains a clear explanation of what the change does, why it's important (what problem does it solve?), and, if relevant, include things like code samples and/or performance numbers. This content may not be exactly what goes into the blog post, but it will help the team putting together the announcement. Thanks! |
This was referenced Oct 13, 2022
3 tasks
1 task
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #43135
Container images want to be able to specify ports rather than urls. We want to avoid overloading the definition for ASPNETCORE_URLS, so this adds support for ASPNETCORE_HTTP_PORTS and ASPNETCORE_HTTPS_PORTS. URLS still takes priority, these new variables will be ignored if URLS is set.
Each is a list of semi-colon delimited values that will be mapped to
http(s)://*:{port}respectively.This will cause Kestrel to bind to all public IPs with IPv4 and IPv6 for the given ports.
This would also work with Http.Sys though we have a warning there not to use wildcards.
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/httpsys?view=aspnetcore-6.0#configure-windows-server
This is only implemented for generic web host and newer, not legacy webhost.