Skip to content

Add h2c origin support#2

Closed
mannie-exe wants to merge 6 commits into
masterfrom
contrib/h2c-origin-upstream-20260516
Closed

Add h2c origin support#2
mannie-exe wants to merge 6 commits into
masterfrom
contrib/h2c-origin-upstream-20260516

Conversation

@mannie-exe
Copy link
Copy Markdown

Summary

  • Add originRequest.h2cOrigin and --h2c-origin for HTTP/2 cleartext origin connections.
  • Use http2.Transport{AllowHTTP: true} for http:// origins when h2c origin mode is enabled.
  • Reject invalid h2cOrigin configurations with https:// origins or simultaneous http2Origin.
  • Warn when http2Origin is configured for a cleartext http:// origin, where Go falls back to HTTP/1.1.
  • Warn when QUIC response trailers are dropped and recommend --protocol http2 for gRPC trailer support.

Scope

This does not implement full gRPC support or QUIC trailer transport. It only adds the h2c origin transport path and related warnings.

Fixes cloudflare#1304.
Refs cloudflare#682.

Testing

  • git diff --check
  • go test -mod=vendor ./config ./ingress ./connection
  • go test -mod=vendor ./cmd/cloudflared/tunnel
  • HOME="$(mktemp -d)" make test lint
  • go run -mod=vendor ./cmd/cloudflared tunnel --help | rg "h2c-origin"
  • go run -mod=vendor ./cmd/cloudflared tunnel --h2c-origin --help
  • cloudflared tunnel ingress validate smoke tests for valid h2cOrigin and invalid h2cOrigin + http2Origin

- Add t.Parallel() to TestHTTPResponseAdapterAddTrailerLogs and subtests
- Add t.Parallel() to TestHttp2OriginWithHTTPSchemeWarning and subtests
- Replace ignored error with explicit require.Error assertion for the
  https+http2Origin case where TLS cert loading fails as expected
@mannie-exe
Copy link
Copy Markdown
Author

Superseded by #3 from feat/h2c-origin, which keeps this fork review PR on the fork baseline while leaving contrib/h2c-origin-upstream-20260516 available for a later upstream PR.

@mannie-exe mannie-exe closed this May 16, 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.

💡Support h2c origin servers

1 participant