Skip to content

Commit f26d0f1

Browse files
authored
Drop the Strict-Transport-Security response header #1862 (#1984)
1 parent 659aa0b commit f26d0f1

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

docs/docfx/articles/header-guidelines.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Headers are a very important part of processing HTTP requests and each have thei
99

1010
## YARP header filtering
1111

12-
YARP automatically removes request and response headers that could impact its ability to forward a request correctly, or that may be used maliciously to bypass features of the proxy. A complete list can be found [here](https://github.com/microsoft/reverse-proxy/blob/b0a24521b269c030c50617f9fc56be9b8a3fe247/src/ReverseProxy/Forwarder/RequestUtilities.cs#L65-L81), with some highlights described below.
12+
YARP automatically removes request and response headers that could impact its ability to forward a request correctly, or that may be used maliciously to bypass features of the proxy. A complete list can be found [here](https://github.com/microsoft/reverse-proxy/blob/main/src/ReverseProxy/Forwarder/RequestUtilities.cs#L63), with some highlights described below.
1313

1414
### Connection, KeepAlive, Close
1515

src/ReverseProxy/Forwarder/RequestUtilities.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ internal static bool ShouldSkipResponseHeader(string headerName)
6060
return _headersToExclude.Contains(headerName);
6161
}
6262

63-
private static readonly HashSet<string> _headersToExclude = new(17, StringComparer.OrdinalIgnoreCase)
63+
private static readonly HashSet<string> _headersToExclude = new(18, StringComparer.OrdinalIgnoreCase)
6464
{
6565
HeaderNames.Connection,
6666
HeaderNames.TransferEncoding,
@@ -79,6 +79,7 @@ internal static bool ShouldSkipResponseHeader(string headerName)
7979
HeaderNames.UpgradeInsecureRequests,
8080
HeaderNames.TE,
8181
HeaderNames.AltSvc,
82+
HeaderNames.StrictTransportSecurity,
8283
};
8384

8485
// Headers marked as HttpHeaderType.Content in

test/ReverseProxy.Tests/Forwarder/HttpTransformerTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class HttpTransformerTests
3333
HeaderNames.UpgradeInsecureRequests,
3434
HeaderNames.TE,
3535
HeaderNames.AltSvc,
36+
HeaderNames.StrictTransportSecurity,
3637
};
3738

3839
[Fact]

0 commit comments

Comments
 (0)