如何在Wildfly 8.2中将http从http重定向到https? [英] How can I do a 301 redirect from http to https in Wildfly 8.2?

查看:220
本文介绍了如何在Wildfly 8.2中将http从http重定向到https?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆