Spring Boot redirect HTTP to HTTPS
For Tomcat to perform a redirect, you need to configure it with one or more security constraints. You can do this by post-processing the Context using a TomcatEmbeddedServletContainerFactory subclass. For example: TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory() { @Override protected void postProcessContext(Context context) { SecurityConstraint securityConstraint = new SecurityConstraint(); securityConstraint.setUserConstraint(“CONFIDENTIAL”); SecurityCollection collection = new SecurityCollection(); collection.addPattern(“/*”); … Read more