2015-06-04 28 views

回答

0

您可以将Spring-Security添加到您的项目中,然后配置Spring-Security以强制执行https。你可以在

org.springframework.security.config.annotation.web.builders.HttpSecurity#requiresChannel() 
+0

根据应该是解决方案的文档,但由于我们目前在cloudfoundry上运行,我使用此处指定的http标头实现了自定义筛选器:http://stackoverflow.com/questions/28227583/pivotal-cloudfoundry-enforcing- HTTPS的SSL –

0

JavaDoc中找到一个小例子,实际上你得在春季启动应用程序2个端口,因此你必须创建另一个EmbeddedServletContainerFactory告诉新的端口或者HTTP或HTTPS。新端口创建后,您可以使用Spring Mvc或Spring Security来管理重定向。