use of org.apereo.cas.configuration.model.core.web.tomcat.CasEmbeddedApacheTomcatHttpProxyProperties in project cas by apereo.
the class CasEmbeddedContainerTomcatConfiguration method configureHttpProxy.
private void configureHttpProxy(final TomcatEmbeddedServletContainerFactory tomcat) {
final CasEmbeddedApacheTomcatHttpProxyProperties proxy = casProperties.getServer().getHttpProxy();
if (proxy.isEnabled()) {
LOGGER.debug("Customizing HTTP proxying for connector listening on port [{}]", tomcat.getPort());
tomcat.getTomcatConnectorCustomizers().add(connector -> {
connector.setSecure(proxy.isSecure());
connector.setScheme(proxy.getScheme());
if (StringUtils.isNotBlank(proxy.getProtocol())) {
LOGGER.debug("Setting HTTP proxying protocol to [{}]", proxy.getProtocol());
connector.setProtocol(proxy.getProtocol());
}
if (proxy.getRedirectPort() > 0) {
LOGGER.debug("Setting HTTP proxying redirect port to [{}]", proxy.getRedirectPort());
connector.setRedirectPort(proxy.getRedirectPort());
}
if (proxy.getProxyPort() > 0) {
LOGGER.debug("Setting HTTP proxying proxy port to [{}]", proxy.getProxyPort());
connector.setProxyPort(proxy.getProxyPort());
}
connector.addUpgradeProtocol(new Http2Protocol());
proxy.getAttributes().forEach(connector::setAttribute);
LOGGER.info("Configured connector listening on port [{}]", tomcat.getPort());
});
} else {
LOGGER.debug("HTTP proxying is not enabled for CAS; Connector configuration for port [{}] is not modified.", tomcat.getPort());
}
}
Aggregations