2014-10-03 25 views
1

是否可以在同一独立Wildfly上运行SSL和非SSL Web应用程序?是否可以在相同的独立Wildfly上运行SSL和非SSL Web应用程序?

我正在使用Wildfly 8.1.0(Undertow),并且在配置此场景时遇到问题... 例如,我知道如何自己配置HTTP或HTTPS,但每当我尝试运行配置时两者HTTP响应重定向到SSL一个... :(

可能有人请指出如何在默认standalone.xml例如改变?

回答

3

是的,它是可能的。

第一您需要在ApplicationRealm中添加波纹管代码

<server-identities> 
    <ssl> 
     <keystore path="server.keystore" relative-to="jboss.server.config.dir" keystore-password="abcd1234" alias="server" key-password="abcd1234"/> 
    </ssl> 
</server-identities> 

然后你需要添加lisner用于HTTP和HTTPS

<server name="default-server"> 
    <http-listener name="default-http" socket-binding="http"/> 
    <https-listener name="default-https" socket-binding="https" security-realm="ApplicationRealm"/> 
    <host name="default-host" alias="localhost"> 
     <location name="/" handler="welcome-content"/> 
     <filter-ref name="server-header"/> 
     <filter-ref name="x-powered-by-header"/> 
    </host> 
</server> 

现在配置连接器,用于HTTP和HTTPS

<subsystem xmlns="urn:jboss:domain:remoting:2.0"> 
    <endpoint worker="default"/> 
    <http-connector name="http-remoting-connector" connector-ref="default-http" security-realm="ApplicationRealm"/> 
    <http-connector name="https-remoting-connector" connector-ref="default-https" security-realm="ApplicationRealm"/> 
</subsystem> 

但一般人不会让同时启用HTTP和https。他们将请求从http重定向到https。

+0

感谢@Moes你的例子,我现在正在尝试使用它。但是,为什么要为HTTP ApplicationRealm添加SSL配置?编辑:我看到只有1 applicationrealm,我被你的“两个” – Deim0s 2015-01-05 15:56:06

+0

迷惑是错误的错误。正确的句子是“首先需要在ApplicationRealm中添加波纹管代码”。如果它有效,请将其标记为答案。 – Dhiren 2015-01-06 05:59:38

+0

是的,我确认它可行,谢谢!在另一个配置文件中,我有你提到的自动重定向,这是不受欢迎的。附:请修复答案错字 – Deim0s 2015-01-09 14:28:58

相关问题