reverseproxy: Set Host to {upstream_hostport} automatically if TLS#7454
Open
francislavoie wants to merge 1 commit intomasterfrom
Open
reverseproxy: Set Host to {upstream_hostport} automatically if TLS#7454francislavoie wants to merge 1 commit intomasterfrom
Host to {upstream_hostport} automatically if TLS#7454francislavoie wants to merge 1 commit intomasterfrom
Conversation
Member
|
It probably is a good idea as part of a "well-behaved proxy" for the SNI and Host header to be in agreement by default. For context for other visitors: we do know of at least one situation where it's too easy to misconfigure in a way that causes a security issue, without this patch. It's not a security fix in and of itself, but the goal is to prevent misconfigurations that are too easy, and which do cause security issues. |
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.
For almost the entire life of Caddy v2, we've had a recommendation to set
header_up Host {upstream_hostport}when configuringreverse_proxyfor HTTPS.I think it's time that we make this the default. It's sensible to make the
Hostheader match the upstream address when we know the server is configured with TLS. If the user needs something different, it's fine, their ownheader_uprules will be applied afterwards and take priority, e.g. withheader_up Host {host}to reset it to the default host. This is so rare to be correct though, in our experience.This also fixes some major footguns when you forget to set
header_up Host {upstream_hostport}which can cause tricky misbehaviour depending on the upstream's handling of theHostheader.Assistance Disclosure
I used Copilot to iterate on the changes, but finished and tested it by hand.