I'm trying to use AJP protocol to communicate with the app created using Spring Boot 2.2.6 with embedded Tomcat and containerised using this official guide. My server uses Apache Server to proxy all requests to different apps and containerised Spring boot app is one of them. Communication works just fine when using http - AJP communication doesn't work though. Moreover, it works just fine when I didn't containerised the app and just launch it using java
command-line tool.
I'm using AJPing script to check AJP access.
And here is AJP connector configuration:
@Configuration
public class TomcatConfiguration implements WebServerFactoryCustomizer<TomcatServletWebServerFactory>
{
@Value( "${tomcat.ajp.secret}" )
String ajpSecret;
@Override
public void customize( TomcatServletWebServerFactory factory )
{
factory.addAdditionalTomcatConnectors( ajpConnector() );
}
private Connector ajpConnector()
{
Connector connector = new Connector( "AJP/1.3" );
AjpNioProtocol protocol = (AjpNioProtocol) connector.getProtocolHandler();
protocol.setSecret( ajpSecret );
connector.setPort( 8009 );
connector.setSecure( true );
return connector;
}
}