如何在openshift中强制https on wildfly 8.1?

Pim*_*oek 1 https openshift wildfly

所以我在openshift上运行这个应用程序,它使用了wildfly 8.1盒式磁带.我想强制所有网址通过https而不是http.

Https工作正常,但我也可以使用http访问相同的页面.这是我要禁用的内容.

我发现了这篇知识库文章:https: //www.openshift.com/kb/kb-e1044-how-to-redirect-traffic-to-https但这并未描述wildfly特有的配置.

这是我在openshift上的wildfly的standalone.xml配置:http://pastebin.com/hg7WY5Uj

Pim*_*oek 5

固定.

在我的web.xml中添加了以下内容:

<security-constraint>
    <web-resource-collection>
        <web-resource-name>Viewpoint Secure URLs</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>
Run Code Online (Sandbox Code Playgroud)

这导致每个URL重定向到https.但是端口是8443.要使用默认端口443,我调整了config/standalone.xml:

在socket-binding-group中更改:

<socket-binding name="https" port="${jboss.https.port:8443}"/>
Run Code Online (Sandbox Code Playgroud)

至

<socket-binding name="https" port="${jboss.https.port:443}"/>
Run Code Online (Sandbox Code Playgroud)