dotnet / dotnet/AspNetCore.Docs
HSTS Configuration for docker container on App Service
- Dominant language
- C#
- Stars
- 13.1k
- Forks
- 24.6k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 97
Description
### Description
Not sure this is the correct page on comment on but seems to be the closest
I'm trying to get the `Strict-Transport-Security` header emitted whilst running as a docker container in Azure App Service and the advice given doesn't work i.e. I have the ForwardedHeadersOptions and the UseHsts set but no headers configured.
I did find a [blog article](https://developers.de/2022/09/26/how-to-deploy-asp-net-with-enabled-ssl-in-linux-container) which gives a solution that works...
```
services.Configure(options =>
{
options.ForwardedHeaders = ForwardedHeaders.All;
options.KnownNetworks.Clear();
options.KnownProxies.Clear();
});
```
Clearing the values then turns on the header, which implies the defaults don't work for my scenario, so...
1. What should the KnownNetworks be set to
2. What should the KnownProxies be set to
### Page URL
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/proxy-load-balancer?view=aspnetcore-8.0#when-it-isnt-possible-to-add-forwarded-headers-and-all-requests-are-secure
### Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/host-and-deploy/proxy-load-balancer.md
### Document ID
c48abb08-bea3-dcff-c067-2edf5dc9b3a6
### Article author
@Rick-Anderson
Contributor guide
Assessment
This issue has not been assessed yet.