-
Notifications
You must be signed in to change notification settings - Fork 896
Closed
Labels
Type: BugSomething isn't workingSomething isn't workinghelp wantedWe will welcome a contributionWe will welcome a contribution
Milestone
Description
Describe the bug
We return a duplicated Strict-Transport-Security response header when using the HSTS middleware (UseHsts) and the destination also includes a Strict-Transport-Security response header.
Producing this duplicated response header can be problematic, though it is generally benign (see: Is it fine to use duplicate response header with same value?)
To Reproduce
Proxy setup (pseudo-code):
app.UseHsts();
app.UseRouting();
app.UseEndpoints(endpoints => endpoints.MapReverseProxy());Destination setup:
- Returns a
Strict-Transport-Securityresponse header.
Suggested fix
Do not return a duplicated Strict-Transport-Security value. Perhaps YARP should IGNORE the destination's response header when HSTS is already applied to the current response -- since the YARP-based server already owns TLS termination, it seems reasonable that it should also own the HSTS response.
Further technical details
Repro's with:
- .NET 6.0.8
- YARP 1.1.1
Metadata
Metadata
Assignees
Labels
Type: BugSomething isn't workingSomething isn't workinghelp wantedWe will welcome a contributionWe will welcome a contribution