Skip to content

net/http/httputil: ReverseProxy forwards Upgrade headers and silently proxies HTTP/2 #80416

Description

@rolandshoemaker

net/http/httputil.ReverseProxy forwards Connection: Upgrade and Upgrade headers from client requests to the backend. When a client sends a request with an Upgrade: h2c header (indicating an upgrade to unencrypted HTTP/2) and the backend accepts it, the connection switches to HTTP/2. Subsequent traffic is then handled as raw bidirectional data, making the HTTP/2 frames invisible to
ReverseProxy and bypassing any path, host, or header restrictions enforced by Director or Rewrite.

Expected Behavior

According to the ReverseProxy documentation, hop-by-hop headers, including Upgrade, are removed from client requests.

Actual Behavior

Upgrade headers are forwarded to the backend, enabling h2c upgrades that result in HTTP/2 traffic being proxied without protocol awareness.

This was originally reported by Anthropic CVD.

cc @neild

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions