How to force https on wildfly 8.1 in openshift?

我们两清 提交于 2019-12-22 00:52:44

问题


So I have this app running on openshift that uses the wildfly 8.1 cartridge. I would like to force all urls to go through https instead of http.

Https is working fine, but I can also access the same pages using http. Which is what I want to disable.

I've found this KB article: https://www.openshift.com/kb/kb-e1044-how-to-redirect-traffic-to-https but this doesn't describe the configuration for wildfly specifc.

This is my standalone.xml config from wildfly on openshift: http://pastebin.com/hg7WY5Uj


回答1:


Fixed.

Added the following to my 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>

This results in a redirect to https for every url. But the port is 8443. To use the default port 443 I've adjusted my config/standalone.xml:

In the socket-binding-group change:

<socket-binding name="https" port="${jboss.https.port:8443}"/>

to

<socket-binding name="https" port="${jboss.https.port:443}"/>


来源:https://stackoverflow.com/questions/24466786/how-to-force-https-on-wildfly-8-1-in-openshift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!