You should set AllowedHosts with host filtering middleware when you want to restrict your ASP.NET Core app to specific hostnames. By defining the AllowedHosts key in your configuration (e.g., appsettings.json), you can ensure that your app only responds to requests from those specific hosts. Requests from other hosts will result in a default bad request (400) response. Keep in mind that this is different from CORS, which controls external origins that can access your app’s resources. If you need to manage cross-origin requests, use CORS; if you want to limit your app to specific hosts, use AllowedHosts.
Does this PR introduce a user-facing change?:
Indirectly, it encourages the use of https in the web browser when running Health Checks
Please make sure you've completed the relevant tasks for this PR, out of the following list:
Special notes for your reviewer:
You should set AllowedHosts with host filtering middleware when you want to restrict your ASP.NET Core app to specific hostnames. By defining the AllowedHosts key in your configuration (e.g., appsettings.json), you can ensure that your app only responds to requests from those specific hosts. Requests from other hosts will result in a default bad request (400) response. Keep in mind that this is different from CORS, which controls external origins that can access your app’s resources. If you need to manage cross-origin requests, use CORS; if you want to limit your app to specific hosts, use AllowedHosts.
Does this PR introduce a user-facing change?: Indirectly, it encourages the use of https in the web browser when running Health Checks
Please make sure you've completed the relevant tasks for this PR, out of the following list: