我正在使用 spring boot (1.2.3) 和嵌入式 undertow。出于安全原因,我更愿意将任何 http 请求重定向到 https,但我找不到这样做的示例。
下面是spring boot和tomcat的例子: Spring boot - Embeded Tomcat HTTP to HTTPS redirect
有没有人有使用 undertow 执行此操作的解决方案?
最佳答案
您可以将 Spring-Security 添加到您的项目中,然后配置 Spring-Security 以强制执行 https。您可以在 JavaDoc 中找到一个小示例
org.springframework.security.config.annotation.web.builders.HttpSecurity#requiresChannel()
关于java - 在 spring boot embedded undertow 上将 http 重定向到 https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30645167/