Skip to content

feat: add opt-in h2c support for the http checker#473

Merged
atkrad merged 1 commit intowait4x:mainfrom
mridang:feat/http-h2c-support
Oct 20, 2025
Merged

feat: add opt-in h2c support for the http checker#473
atkrad merged 1 commit intowait4x:mainfrom
mridang:feat/http-h2c-support

Conversation

@mridang
Copy link
Contributor

@mridang mridang commented Oct 20, 2025

This PR enables optional h2c for http:// URLs while keeping current behavior unchanged by default.

What’s included

  • WithH2C(bool) option and --h2c flag to opt into h2c.
  • Uses http2.Transport{AllowHTTP:true} for cleartext HTTP only when:
    • h2c is enabled,
    • the URL scheme is http,
    • no HTTP proxy is configured, and
    • --no-redirect is set (avoids cross-scheme redirect issues).
  • Default behavior preserved: HTTPS negotiates h2 via ALPN; HTTP remains HTTP/1.1 when h2c is off.
  • Coverage added both at checker level and via the CLI path to verify end-to-end h2c.

Why

  • Some local/dev/sidecar endpoints speak h2c; this makes Wait4X compatible without impacting existing users.

- Add `WithH2C(bool)` option to enable HTTP/2 cleartext (h2c) for `http://` URLs
- Use `http2.Transport{AllowHTTP: true}` when h2c is enabled, scheme is `http`,
  no proxy is configured for the target URL, and `--no-redirect` is set
- Keep default behavior unchanged (h2 over TLS via ALPN; HTTP remains HTTP/1.1)
- Add `--h2c` flag to the `http` command to expose the option via CLI
- Add unit tests for h2c at checker level and CLI level

Rationale:
- Some services expose HTTP/2 over cleartext (h2c) for local/dev or sidecar endpoints.
- This makes Wait4X compatible with those endpoints without impacting existing users.

Notes:
- h2c is intentionally opt-in to avoid proxy/redirect edge cases.
- If an HTTP proxy is configured, the client falls back to the standard transport.
@mridang mridang changed the title feat(http): add opt-in h2c support (+ CLI flag) and tests feat(http): add opt-in h2c support for the http checker Oct 20, 2025
@mridang mridang changed the title feat(http): add opt-in h2c support for the http checker feat: add opt-in h2c support for the http checker Oct 20, 2025
@atkrad atkrad self-requested a review October 20, 2025 22:21
@atkrad atkrad added the feature New feature or request label Oct 20, 2025
@mridang
Copy link
Contributor Author

mridang commented Oct 20, 2025

Hi @atkrad, thanks for the prompt action on this. Here is some additional context zitadel/zitadel-charts#463 It would be great to get this out. 🙏🏻

@atkrad
Copy link
Member

atkrad commented Oct 20, 2025

Hi @mridang, Thanks for the contribution.

@atkrad atkrad merged commit 97f6539 into wait4x:main Oct 20, 2025
4 checks passed
@atkrad
Copy link
Member

atkrad commented Oct 20, 2025

@mridang I’ll let you know here as soon as it’s released.

@atkrad
Copy link
Member

atkrad commented Oct 20, 2025

@mridang https://github.com/wait4x/wait4x/releases/tag/v3.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants