Skip to content

fix: remove wrong Host header assignment#2650

Open
sunfkny wants to merge 1 commit intoMetaCubeX:Alphafrom
sunfkny:fix-proxy-host
Open

fix: remove wrong Host header assignment#2650
sunfkny wants to merge 1 commit intoMetaCubeX:Alphafrom
sunfkny:fix-proxy-host

Conversation

@sunfkny
Copy link
Copy Markdown

@sunfkny sunfkny commented Mar 28, 2026

Mihomo was previously assigning request.Host from the client-provided Host header:

This could cause requests to fail when the client sets an unexpected Host (e.g., jawah/niquests#355). Removing this assignment ensures the Host is derived from the absolute-form URL in readRequest

@sunfkny
Copy link
Copy Markdown
Author

sunfkny commented Mar 28, 2026

RFC 9112 3.2.2:

When a proxy receives a request with an absolute-form of request-target, the proxy MUST ignore the received Host header field (if any) and instead replace it with the host information of the request-target. A proxy that forwards such a request MUST generate a new Host field value based on the received request-target rather than forward the received Host field value.

@wwqgtxx wwqgtxx force-pushed the Alpha branch 5 times, most recently from 454dd12 to 1b2ea14 Compare April 11, 2026 04:01
@wwqgtxx wwqgtxx force-pushed the Alpha branch 2 times, most recently from 46220ad to e0a42d4 Compare April 16, 2026 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant