Skip to content

Add Alt-Svc header support to advertise HTTP/3 availability#20434

Merged
reta merged 2 commits intoopensearch-project:mainfrom
reta:issue-20433
Jan 22, 2026
Merged

Add Alt-Svc header support to advertise HTTP/3 availability#20434
reta merged 2 commits intoopensearch-project:mainfrom
reta:issue-20433

Conversation

@reta
Copy link
Copy Markdown
Contributor

@reta reta commented Jan 18, 2026

Description

It is impossible to determine, in advance, whether a target server supports HTTP/3. It is also impossible to upgrade an existing HTTP/1.1 or HTTP/2 connection to an HTTP/3 connection, since HTTP/1.1 and HTTP/2 are built on top of TCP streams while HTTP/3's QUIC is built on top of UDP datagrams.

By default, if enabled, HTTP/3 transport is available on the same port as HTTP/1.1 and HTTP/2 transports. The Alt-Svc header (see please [1]) is the standard way to advertise alternative services (HTTP/2 or HTTP/3).

Examples:

  • when HTTP/2 is used
< HTTP/2 200
< alt-svc: h3=":9200"; ma=3600
< x-opensearch-version: OpenSearch/3.5.0-SNAPSHOT (opensearch)
< content-type: application/json; charset=UTF-8
< content-length: 572
  • when HTTP/3 is used
< HTTP/3 200
< alt-svc: h2=":9200"; ma=3600
< x-opensearch-version: OpenSearch/3.5.0-SNAPSHOT (opensearch)
< content-type: application/json; charset=UTF-8
< content-length: 572

[1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Alt-Svc

Related Issues

Closes #20433

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@reta reta requested review from a team and peternied as code owners January 18, 2026 19:24
@github-actions github-actions bot added enhancement Enhancement or improvement to existing feature or request Other v3.5.0 Issues and PRs related to version 3.5.0 labels Jan 18, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 18, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

This PR implements Alt-Svc header support to advertise HTTP/3 availability on OpenSearch servers. It introduces a factory-based system to generate version-specific response headers, threads this factory through the Netty HTTP request/response handling pipeline, and adds integration tests validating HTTP/2 and HTTP/3 advertising behavior.

Changes

Cohort / File(s) Summary
Interface and Factory for Alt-Svc Headers
modules/transport-netty4/src/main/java/org/opensearch/http/netty4/HttpResponseHeadersFactory.java, modules/transport-netty4/src/main/java/org/opensearch/http/netty4/HttpResponseHeadersFactories.java
Introduces a new HttpResponseHeadersFactory interface with a single method headers(HttpVersion version) for producing protocol-specific response headers. HttpResponseHeadersFactories provides factory methods: newHttp2Aware() and newHttp3Aware() (with HTTP/3 availability checks and settings-driven feature flags), plus newDefault() for no-op behavior.
Request Creator Updates
modules/transport-netty4/src/main/java/org/opensearch/http/netty4/Netty4Http3RequestCreator.java, modules/transport-netty4/src/main/java/org/opensearch/http/netty4/Netty4HttpRequestCreator.java
Both request creators now accept and store an HttpResponseHeadersFactory parameter, propagating it into constructed Netty4HttpRequest objects across normal and error paths.
Request and Response Handling
modules/transport-netty4/src/main/java/org/opensearch/http/netty4/Netty4HttpRequest.java
Constructor signatures extended to accept HttpResponseHeadersFactory. New private field stores the factory; createResponse() now applies headers from the factory to the produced response based on HTTP protocol version. Headers are preserved through copy and transform operations.
Transport Layer Integration
modules/transport-netty4/src/main/java/org/opensearch/http/netty4/Netty4HttpServerTransport.java, modules/transport-netty4/src/main/java/org/opensearch/http/netty4/Netty4Http3ServerTransport.java, modules/transport-netty4/src/main/java/org/opensearch/http/netty4/ssl/SecureNetty4HttpServerTransport.java
HttpChannelHandler now accepts a new HttpResponseHeadersFactory parameter. HTTP/3 transport passes Http2Aware factory; secure transport passes Http3Aware factory. Factory is threaded into request creator initialization.
Integration Test
modules/transport-netty4/src/internalClusterTest/java/org/opensearch/http/netty4/Netty4Http3IT.java
New integration test with a nested SecureSettingsPlugin that provides TLS/SSL configuration for HTTP/2 and HTTP/3. Tests validate Alt-Svc headers and opaque IDs for GET and POST requests; includes HTTP/3 availability checks and per-node secure settings provisioning.
Test Updates
modules/transport-netty4/src/test/java/org/opensearch/http/netty4/Netty4HttpPipeliningHandlerTests.java, modules/transport-netty4/src/test/java/org/opensearch/http/netty4/Netty4HttpServerPipeliningTests.java
Updated to pass HttpResponseHeadersFactories.newDefault() when constructing Netty4HttpRequest and HttpChannelHandler in test contexts.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • #20017: Implements core HTTP/3 server-side transport support; this PR builds on top by adding Alt-Svc header advertisement for HTTP/3 availability.

Suggested labels

enhancement

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.16% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title accurately describes the main change: adding Alt-Svc header support to advertise HTTP/3 availability, which is the primary objective.
Linked Issues check ✅ Passed The code changes implement Alt-Svc header support across HTTP transport classes: new HttpResponseHeadersFactory interface and HttpResponseHeadersFactories utilities create Alt-Svc headers with h2/h3 protocols, integration tests validate HTTP/2 and HTTP/3 behavior with Alt-Svc headers, and HTTP transport classes propagate the factory through request/response cycles.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing Alt-Svc header support for HTTP/3 advertising. Constructor signature updates to propagate HttpResponseHeadersFactory and test updates to pass the factory are in scope.
Description check ✅ Passed The PR description comprehensively covers the purpose, includes related issues, and follows the template structure with all required sections completed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 627e5f8: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 0e8b051: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 0e8b051: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 0e8b051: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

✅ Gradle check result for 7556129: SUCCESS

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 64.21053% with 34 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.30%. Comparing base (dbb6d2e) to head (1ebdcbc).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...p/reactor/netty4/HttpResponseHeadersFactories.java 30.43% 13 Missing and 3 partials ⚠️
...arch/http/netty4/HttpResponseHeadersFactories.java 52.00% 11 Missing and 1 partial ⚠️
.../org/opensearch/http/netty4/Netty4HttpRequest.java 77.77% 2 Missing ⚠️
...tty4/ReactorNetty4NonStreamingRequestConsumer.java 66.66% 1 Missing and 1 partial ⚠️
...nsearch/http/netty4/Netty4Http3RequestCreator.java 80.00% 1 Missing ⚠️
.../http/reactor/netty4/ReactorNetty4HttpRequest.java 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #20434   +/-   ##
=========================================
  Coverage     73.29%   73.30%           
- Complexity    71990    71996    +6     
=========================================
  Files          5793     5795    +2     
  Lines        329110   329181   +71     
  Branches      47402    47405    +3     
=========================================
+ Hits         241236   241291   +55     
+ Misses        68634    68579   -55     
- Partials      19240    19311   +71     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for d3dad7b: ABORTED

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for d3dad7b: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

✅ Gradle check result for d3dad7b: SUCCESS

@reta
Copy link
Copy Markdown
Contributor Author

reta commented Jan 19, 2026

@cwperks @andrross would appreciate if you folks find the time to take a look, closes the gap on HTTP/3 experimental support, thank you!

reta added 2 commits January 20, 2026 15:31
Signed-off-by: Andriy Redko <drreta@gmail.com>
Signed-off-by: Andriy Redko <drreta@gmail.com>
@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 1ebdcbc: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 1ebdcbc: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 1ebdcbc: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 1ebdcbc: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 1ebdcbc: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 1ebdcbc: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 1ebdcbc: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 1ebdcbc: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 1ebdcbc: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 1ebdcbc: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 1ebdcbc: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 1ebdcbc: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

✅ Gradle check result for 1ebdcbc: SUCCESS

@reta reta merged commit af61c36 into opensearch-project:main Jan 22, 2026
49 of 76 checks passed
tanyabti pushed a commit to tanyabti/OpenSearch that referenced this pull request Feb 24, 2026
…ch-project#20434)

* Add Alt-Svc header support to advertise HTTP/3 availability

Signed-off-by: Andriy Redko <drreta@gmail.com>

* Address code review comments

Signed-off-by: Andriy Redko <drreta@gmail.com>

---------

Signed-off-by: Andriy Redko <drreta@gmail.com>
tanyabti pushed a commit to tanyabti/OpenSearch that referenced this pull request Feb 24, 2026
…ch-project#20434)

* Add Alt-Svc header support to advertise HTTP/3 availability

Signed-off-by: Andriy Redko <drreta@gmail.com>

* Address code review comments

Signed-off-by: Andriy Redko <drreta@gmail.com>

---------

Signed-off-by: Andriy Redko <drreta@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

distributed framework enhancement Enhancement or improvement to existing feature or request Other v3.5.0 Issues and PRs related to version 3.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add Alt-Svc header support to advertise HTTP/3 availability

2 participants