Skip to content

feat(nginx): add optional HTTP/3 (QUIC) support - #457

Open
fzipi wants to merge 3 commits into
coreruleset:mainfrom
fzipi:feat/nginx-http3-quic
Open

feat(nginx): add optional HTTP/3 (QUIC) support#457
fzipi wants to merge 3 commits into
coreruleset:mainfrom
fzipi:feat/nginx-http3-quic

Conversation

@fzipi

@fzipi fzipi commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds an HTTP3 env var (default off) to the nginx image. When set to on, adds a QUIC listener on SSL_PORT, enables http3/quic_retry, and advertises support via the Alt-Svc header.
  • The nginxinc/nginx-unprivileged base image is already compiled with --with-http_v3_module (confirmed against nginx/pkg-oss's Debian and Alpine build configs) — this PR only wires up config, no rebuild needed. Our own build stage rebuilds nginx from source only to produce the ModSecurity/headers-more dynamic modules; the running binary is untouched upstream.
  • Off by default: enabling it requires publishing SSL_PORT as UDP too (e.g. -p 8443:8443/udp), which existing deployments won't have done.
  • CI (verifyimage.yml): publishes SSL_PORT on the existing verification container and asserts no Alt-Svc header by default; starts a second container with HTTP3=on on one matrix leg (nginx-debian-writable-latest, linux/amd64) and asserts the QUIC listener starts and Alt-Svc advertises h3.

Test plan

  • actionlint / shellcheck clean on the new entrypoint script and CI changes (2 pre-existing shellcheck warnings in verifyimage.yml predate this change)
  • zizmor clean on verifyimage.yml
  • Manually verified the sed substitution in 96-update-http3-config.sh for both HTTP3=on and HTTP3=off
  • CI run confirms the container boots with HTTP3=on and serves the Alt-Svc header

AI Disclosure

Per the project's AI-Assisted Contribution Policy:

  1. AI tools used: Claude (Sonnet 5, via Claude Code)
  2. What was generated or assisted: Investigation of whether the base image supports HTTP/3 (read nginx/pkg-oss build configs directly rather than assuming), the HTTP3 env var and 96-update-http3-config.sh entrypoint script (following the existing PROXY_SSL_CONFIG placeholder pattern), template/Dockerfile/README changes, and the CI verification steps in verifyimage.yml.
  3. Review performed: Manually traced the full Dockerfile build to confirm the running image uses the unmodified upstream nginx binary. Verified the sed-based config substitution locally for both on/off states. Ran actionlint, shellcheck, and zizmor against changed files. The actual CI run (container boot + Alt-Svc check) is marked unverified in the test plan above pending this PR's own CI run.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added optional HTTP/3 support for HTTPS connections.
    • HTTP/3 is disabled by default and can be enabled with the HTTP3=on setting.
    • Documented the required UDP port configuration for HTTP/3.
  • Bug Fixes

    • Added verification to confirm HTTP/3 remains disabled by default and works when explicitly enabled.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@fzipi, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 32 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ea4411ca-460f-4d61-ae5a-c1a5c8cd3cff

📥 Commits

Reviewing files that changed from the base of the PR and between 85f9384 and 19f108c.

📒 Files selected for processing (5)
  • .github/workflows/verifyimage.yml
  • README.md
  • nginx/Dockerfile
  • nginx/Dockerfile-alpine
  • nginx/docker-entrypoint.d/96-update-http3-config.sh
📝 Walkthrough

Walkthrough

The image defaults HTTP3 to off, enables conditional HTTP/3 configuration when set to on, documents the setting, and adds workflow checks for disabled-by-default and opt-in behavior.

Changes

HTTP/3 support

Layer / File(s) Summary
Conditional HTTP/3 configuration
nginx/Dockerfile, nginx/Dockerfile-alpine, nginx/docker-entrypoint.d/96-update-http3-config.sh, nginx/templates/conf.d/default.conf.template
The images define HTTP3=off. The entrypoint script replaces HTTP3_CONFIG with HTTP/3 directives when HTTP3=on. The SSL server block includes the configuration hook.
HTTP/3 verification and documentation
.github/workflows/verifyimage.yml, README.md
The workflow rejects Alt-Svc by default and verifies h3 advertisement for an opt-in Debian nginx AMD64 image. The README documents the variable and UDP port requirement.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding optional HTTP/3 support to the nginx image.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

fzipi added 2 commits August 6, 2026 09:39
The nginx-unprivileged base image is already built with
--with-http_v3_module, but nothing enabled it. Adds an HTTP3 env var
(default off) that, when set to "on", adds a QUIC listener alongside
the existing SSL listener, turns on http3, enables quic_retry, and
advertises support via the Alt-Svc header.

Off by default since QUIC needs the SSL_PORT published as UDP too,
which existing deployments won't have done.
Publishes SSL_PORT on the existing verification container and checks
the Alt-Svc header is absent by default. Adds a second, HTTP3=on
container on one matrix leg (nginx-debian-writable-latest, amd64) to
confirm the QUIC listener starts and Alt-Svc advertises h3.
@fzipi
fzipi force-pushed the feat/nginx-http3-quic branch from 27f610c to 85f9384 Compare August 6, 2026 16:39
@fzipi
fzipi marked this pull request as ready for review August 6, 2026 16:39
@fzipi
fzipi requested a review from theseion August 6, 2026 16:40
@fzipi fzipi linked an issue Aug 6, 2026 that may be closed by this pull request

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@nginx/docker-entrypoint.d/96-update-http3-config.sh`:
- Line 11: Update the HTTP3 configuration generation around HTTP3_CONFIG to
define HTTP3_ALT_SVC_PORT with SSL_PORT as its default and use it in the Alt-Svc
advertisement, while keeping the listen directive bound to SSL_PORT. Set
HTTP3_ALT_SVC_PORT to 8444 in the opt-in workflow and assert that the generated
Alt-Svc header advertises port 8444.

In `@README.md`:
- Line 258: Update the README’s HTTP3 configuration entry to describe HTTP/3
independently, explicitly stating that enabling HTTP3 does not enable HTTP/2 and
that HTTP2=off keeps HTTP/2 unavailable over TCP; refer readers to the HTTP2
setting for HTTP/2 control.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a22477b7-a002-4ae1-a592-7bf260ba95cf

📥 Commits

Reviewing files that changed from the base of the PR and between 85caf99 and 85f9384.

📒 Files selected for processing (6)
  • .github/workflows/verifyimage.yml
  • README.md
  • nginx/Dockerfile
  • nginx/Dockerfile-alpine
  • nginx/docker-entrypoint.d/96-update-http3-config.sh
  • nginx/templates/conf.d/default.conf.template

Comment thread nginx/docker-entrypoint.d/96-update-http3-config.sh Outdated
Comment thread README.md Outdated
…rify HTTP2/HTTP3 independence in docs

Adds HTTP3_ALT_SVC_PORT (defaults to SSL_PORT) so the Alt-Svc header
advertises the externally reachable port when it differs from the
container's internal SSL_PORT (e.g. -p 8444:8443/udp). The CI opt-in
test now exercises this remapped-port case directly.

Also clarifies in the README that HTTP3 and HTTP2 are independent
settings; enabling one doesn't affect the other.
HTTP3_CONFIG="listen ${SSL_PORT} quic reuseport; http3 on; quic_retry on; add_header Alt-Svc 'h3=\":${HTTP3_ALT_SVC_PORT}\"; ma=86400' always;"
fi

sed -i.bak -r 's#HTTP3_CONFIG#'"${HTTP3_CONFIG}"'#' /etc/nginx/conf.d/default.conf

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sed -i.bak -r 's#HTTP3_CONFIG#'"${HTTP3_CONFIG}"'#' /etc/nginx/conf.d/default.conf
sed -ir 's#HTTP3_CONFIG#'"${HTTP3_CONFIG}"'#' /etc/nginx/conf.d/default.conf


server {
listen ${SSL_PORT} ssl;
HTTP3_CONFIG

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this really work??

Suggested change
HTTP3_CONFIG
${HTTP3_CONFIG}

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.

Add support for QUIC and HTTP/3 to Nginx images

2 participants