如何在Wildfly 8.2中将http从http重定向到https? [英] How can I do a 301 redirect from http to https in Wildfly 8.2?
问题描述
我的web.xml具有以下安全约束:
My web.xml has the following security constraint:
<security-constraint>
<web-resource-collection>
<web-resource-name>App</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
此配置通过302重定向将所有http URL重定向到https。除了通过Wildfly 8.2中的301重定向之外,有没有办法实现相同的目标?
This configuration redirects all http URLs to https via 302 redirects. Is there a way to accomplish the same except via 301 redirects in Wildfly 8.2?
推荐答案
我能想到的一种方法是使用Predicates基于处理程序的处理程序。请参阅以下链接中的示例:
One way I can think of is using Predicates based handlers in undertow. See the example in the link below:
https://http2.undertow.io/documentation/core/predicates-attributes-handlers.html
该示例解释了可配置302基于请求路径的响应。我想你可以调整它以返回301.
The example explains a configurable 302 response based on request path. I think you can tweak it to return 301.
这篇关于如何在Wildfly 8.2中将http从http重定向到https?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!