AJP as reverse proxy without SSL
In Spring Boot 2.1 (it should also work in some earlier versions), we can enable the AJP connector such as :
import org.apache.catalina.connector.Connector; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.server.WebServerFactoryCustomizer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; @Configuration public class AjpConfiguration { private final Logger log = LoggerFactory.getLogger(AppConfig.class); @Bean public WebServerFactoryCustomizer<TomcatServletWebServerFactory> servletContainer() { return server -> { if (server instanceof TomcatServletWebServerFactory) { ((TomcatServletWebServerFactory) server).addAdditionalTomcatConnectors(redirectConnector()); } }; } private Connector redirectConnector() { Connector connector = new Connector("AJP/1.3"); connector.setScheme("http"); connector.setPort(13080); connector.setSecure(false); connector.setAllowTrace(false); return connector; } } |
To enable the AJP on Apache 2.4, look at the Apache 2.4 post.