如何在openshift中强制https on wildfly 8.1? [英] How to force https on wildfly 8.1 in openshift?
问题描述
所以我在openshift上运行这个应用程序,它使用了wildfly 8.1盒式磁带。
我想强制所有网址都通过https而不是http。
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工作正常,但我也可以使用http访问相同的网页。这就是我要禁用的内容。
Https is working fine, but I can also access the same pages using http. Which is what I want to disable.
我发现了这篇知识库文章: https://www.openshift.com/kb/kb-e1044-how-to-redirect-traffic-to-https
但这并没有描述wildfly特定的配置。
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.
这是我在openshift上来自wildfly的standalone.xml配置: http://pastebin.com/hg7WY5Uj
This is my standalone.xml config from wildfly on openshift: http://pastebin.com/hg7WY5Uj
推荐答案
已修复。
在我的web.xml中添加了以下内容:
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>
这会导致每个网址都重定向到https。但是端口是8443.要使用默认端口443,我调整了我的config / standalone.xml:
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:
在socket-binding-group中更改:
In the socket-binding-group change:
<socket-binding name="https" port="${jboss.https.port:8443}"/>
到
<socket-binding name="https" port="${jboss.https.port:443}"/>
这篇关于如何在openshift中强制https on wildfly 8.1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!