标签:pre tom dad conf direct tor href port cti
1:同时支持http, https配置
参考文献: https://www.cnblogs.com/lianggp/p/8136540.html
2:http 转发到 https配置
@Bean public Connector connector(){ Connector connector=new Connector("org.apache.coyote.http11.Http11NioProtocol"); connector.setScheme("http"); connector.setPort(80); connector.setSecure(false); connector.setRedirectPort(443); return connector; }
@Bean public TomcatEmbeddedServletContainerFactory tomcatServletWebServerFactory(Connector connector){ TomcatEmbeddedServletContainerFactory tomcat=new TomcatEmbeddedServletContainerFactory (){ @Override protected void postProcessContext(Context context) { SecurityConstraint securityConstraint=new SecurityConstraint(); securityConstraint.setUserConstraint("CONFIDENTIAL"); SecurityCollection collection=new SecurityCollection(); collection.addPattern("/*"); securityConstraint.addCollection(collection); context.addConstraint(securityConstraint); } }; tomcat.addAdditionalTomcatConnectors(connector); return tomcat; }
标签:pre tom dad conf direct tor href port cti
原文地址:https://www.cnblogs.com/eason-d/p/9884432.html