Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 5a00863

Browse files
committed
Add missing headers for HTTP/2
1 parent 48e7615 commit 5a00863

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

CHANGES

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ Platform 3.28
77
- We have added HTTPServerModule.enableVirtualThreads(), which enables
88
Jetty's support for Java 21 virtual threads.
99

10+
- We now synthesize the :authority pseudoheader on HTTP/2.
11+
12+
- We now synthesize the Host header on HTTP/1.0 and HTTP/2.
13+
1014
- Remote errors, when detected, are now notified to async applications.
1115

1216
Platform 3.27

http-server/src/main/java/com/proofpoint/http/server/HttpServer.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@
3535
import org.eclipse.jetty.ee10.servlet.security.ConstraintMapping;
3636
import org.eclipse.jetty.ee10.servlet.security.ConstraintSecurityHandler;
3737
import org.eclipse.jetty.http.UriCompliance;
38+
import org.eclipse.jetty.http2.server.AuthorityCustomizer;
3839
import org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory;
3940
import org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory;
4041
import org.eclipse.jetty.jmx.MBeanContainer;
4142
import org.eclipse.jetty.security.LoginService;
4243
import org.eclipse.jetty.security.SecurityHandler;
4344
import org.eclipse.jetty.security.authentication.BasicAuthenticator;
4445
import org.eclipse.jetty.server.ConnectionFactory;
46+
import org.eclipse.jetty.server.HostHeaderCustomizer;
4547
import org.eclipse.jetty.server.HttpConfiguration;
4648
import org.eclipse.jetty.server.HttpConnectionFactory;
4749
import org.eclipse.jetty.server.SecureRequestCustomizer;
@@ -433,6 +435,12 @@ public void start()
433435
baseHttpConfiguration.setSendServerVersion(false);
434436
baseHttpConfiguration.setSendXPoweredBy(false);
435437
baseHttpConfiguration.setNotifyRemoteAsyncErrors(true); // Pass remote exceptions to AsyncContext
438+
439+
// Adds :authority pseudoheader on HTTP/2
440+
baseHttpConfiguration.addCustomizer(new AuthorityCustomizer());
441+
// Adds :host header on HTTP/1.0 and HTTP/2
442+
baseHttpConfiguration.addCustomizer(new HostHeaderCustomizer());
443+
436444
if (config.getMaxRequestHeaderSize() != null) {
437445
baseHttpConfiguration.setRequestHeaderSize(toIntExact(config.getMaxRequestHeaderSize().toBytes()));
438446
}

0 commit comments

Comments
 (0)