diff --git a/mens-core/src/main/java/kr/xit/core/spring/config/support/TomcatConfiguration.java b/mens-core/src/main/java/kr/xit/core/spring/config/support/TomcatConfiguration.java new file mode 100644 index 0000000..f0bb106 --- /dev/null +++ b/mens-core/src/main/java/kr/xit/core/spring/config/support/TomcatConfiguration.java @@ -0,0 +1,37 @@ +package kr.xit.core.spring.config.support; + +import java.net.*; + +import org.apache.catalina.connector.*; +import org.apache.coyote.ajp.*; +import org.springframework.boot.web.embedded.tomcat.*; +import org.springframework.boot.web.servlet.server.*; +import org.springframework.context.annotation.*; + +@Configuration +@Profile({"local-can", "prod-can"}) +public class TomcatConfiguration { + + @Bean + public ServletWebServerFactory servletContainer() { + TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory(); + tomcat.addAdditionalTomcatConnectors(createAjpConnector()); + return tomcat; + } + + private Connector createAjpConnector() { + Connector ajpConnector = new Connector("AJP/1.3"); + ajpConnector.setPort(18009); + ajpConnector.setSecure(false); + ajpConnector.setAllowTrace(false); + ajpConnector.setScheme("http"); + ((AbstractAjpProtocol) ajpConnector.getProtocolHandler()).setSecretRequired(false); + try { + AjpNioProtocol protocol = (AjpNioProtocol) ajpConnector.getProtocolHandler(); + protocol.setAddress(InetAddress.getByName("0.0.0.0")); + } catch (UnknownHostException e) { + throw new RuntimeException(e); + } + return ajpConnector; + } +}