Skip to content

feat: enable h2c support for HTTP masquerade#1505

Open
wellcoming wants to merge 1 commit intoapernet:masterfrom
wellcoming:patch-1
Open

feat: enable h2c support for HTTP masquerade#1505
wellcoming wants to merge 1 commit intoapernet:masterfrom
wellcoming:patch-1

Conversation

@wellcoming
Copy link
Copy Markdown

Description

This PR introduces h2c (HTTP/2 Cleartext) support to the MasqTCPServer.
By wrapping the standard HTTP handler with h2c.NewHandler, the server can now correctly handle both HTTP/1.1 and HTTP/2 requests over non-TLS TCP connections.

Motivation & Context

This improvement is crucial for coexistence with other proxy software, specifically Xray.
When configuring Xray's fallback mechanism, it often forwards traffic in either http/1.1 or h2 (HTTP/2) format depending on the incoming connection. Previously, without h2c support, h2 fallback requests from Xray would fail or be malformed because the masquerade server expected standard HTTP/1.1.
With this change, Hysteria's masquerade server can now accept h2 fallbacks from Xray, allowing for a robust fallback chain (e.g., Xray -> Hysteria Masq).

@wellcoming wellcoming changed the title Add h2c support for HTTP masquerade feat: enable h2c support for HTTP masquerade Jan 14, 2026
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