Skip to content

Conversation

@afarber
Copy link
Contributor

@afarber afarber commented Dec 15, 2025

Fixes #14061

  • Add AltSvcCustomizer to HTTP2ServerConnectionFactory that automatically adds the Alt-Svc header to HTTP/2 responses, advertising HTTP/3 availability with the correct port and configurable ma (max-age) attribute per RFC 7838.
  • AltSvcCustomizer.setMaxAge(Duration) allows configuring the ma attribute (default: 24 hours, set to null to omit)
  • Remove the old AltSvcCustomizer from HTTP3ServerConnectionFactory which incorrectly used the HTTP/2 port
  • Add tests for Alt-Svc header generation and maxAge configuration
  • Update documentation with ma attribute explanation

@sbordet sbordet self-requested a review December 15, 2025 14:57
@sbordet sbordet moved this to ✅ Done in Jetty 12.1.6 Dec 15, 2025
@sbordet sbordet moved this from ✅ Done to 🏗 In progress in Jetty 12.1.6 Dec 15, 2025
@joakime joakime moved this from 🏗 In progress to 👀 In review in Jetty 12.1.6 Dec 15, 2025
@sbordet
Copy link
Contributor

sbordet commented Jan 5, 2026

@afarber, I think it's slightly more complicated.

  1. HTTP2ServerConnectionFactory and HTTP3ServerConnectionFactory share the same HttpConfiguration.
    In this case, HTTP/2 requests will be customized by AltSvcCustomizer, and your fix to look up the HTTP/3 port is good.
  2. However, it may really be the case that the 2 HttpConfigurations are different (because e.g. HTTP/3 has different buffer requirements than HTTP/2).
    In this case, HTTP/2 requests will never be customized.
  3. The Alt-Svc header is minimal and cannot be customized, for example with the ma attribute.

In light of this, I think it is perhaps best to make AltSvcCustomizer a public class with more configuration for the header as specified by RFC 7838.

We can have a http3-alt-svc.mod; module http3 depends on http3-alt-svc, and http3-alt-svc is after http2.

@afarber let me know if you want to continue to work on this given the instructions above, otherwise we'll take over.

Thanks!

@sbordet
Copy link
Contributor

sbordet commented Jan 5, 2026

@lorban thoughts on the above?

@lorban
Copy link
Contributor

lorban commented Jan 5, 2026

@sbordet an alternative could be to move the alt-svc logic to the H2 connection factory: move the AltSvcCustomizer to HTTP2ServerConnectionFactory, add it on construction like we currently do for H3 and make it scan through the server's connectors in search for one that has the h3 protocol and is a network connector to read its port and generate the alt-svc header.

@sbordet sbordet removed this from Jetty 12.1.6 Jan 5, 2026
@sbordet sbordet moved this to 👀 In review in Jetty 12.1.7 Jan 5, 2026
@afarber afarber force-pushed the 14061-alt-avc-port branch from c23feb1 to 64e18c1 Compare January 5, 2026 17:40
@afarber
Copy link
Contributor Author

afarber commented Jan 5, 2026

Hi @sbordet and @lorban, is this what you mean? Moved AltSvcCustomizer to HTTP2ServerConnectionFactory where it scans server.getConnectors() for one with h3 protocol to read the port.

Copy link
Contributor

@lorban lorban left a comment

Choose a reason for hiding this comment

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

There are a few small things to change here and there, but overall this is the idea I had in mind.

@sbordet what do you think of this?

@afarber afarber force-pushed the 14061-alt-avc-port branch from cdc87c6 to 04abe82 Compare January 6, 2026 19:18
@afarber afarber requested a review from lorban January 6, 2026 19:49
@afarber afarber force-pushed the 14061-alt-avc-port branch from f378603 to 2fe1a03 Compare January 10, 2026 10:09
Copy link
Contributor

@lorban lorban left a comment

Choose a reason for hiding this comment

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

Besides a few small improvements to the doc, this LGTM.

BTW, did you sign the Eclipse Contributor Agreement?

@afarber afarber force-pushed the 14061-alt-avc-port branch from 2fe1a03 to 9249f8a Compare January 12, 2026 10:23
@afarber afarber requested a review from lorban January 12, 2026 12:12
@lorban
Copy link
Contributor

lorban commented Jan 12, 2026

@sbordet is there anything you want to add to this?

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

Labels

None yet

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

Jetty 12.1.4 demo HTTP/3 wrong port in alt-svc response header

3 participants