I am trying to configure Jetty 9.4.39.v20210325 in java Spring Boot 2.4.5 to accept proxy protocol V2 traffic. I want to do this programmatically in a spring configuration class. This is the method I wrote in the SharedConfiguration.java
configuration class based on the Proxy Protocol section on the bottom of this page.
@Bean
public ConfigurableServletWebServerFactory
jettyCustomizer() {
JettyServletWebServerFactory factory = new JettyServletWebServerFactory();
factory.addServerCustomizers(server -> {
ProxyConnectionFactory proxyConnectionFactory = new ProxyConnectionFactory();
ServerConnector serverConnector = new ServerConnector(server, proxyConnectionFactory);
server.addConnector(serverConnector);
});
return factory;
}
The HTTP traffic is coming from an AWS EC2 network load balancer (NLB) and the balancer has proxy protocol V2 traffic enabled.
I am getting this response when I activate an endpoint in my service with the proxy protocol traffic:
Bad Message 400
reason: Illegal character CNTL=0x0
Does anyone know how I can get my service to accept this proxy protocol V2 traffic? I'm unsure if I am configuring Jetty correctly to do so.
Thanks!