【问题标题】:Is it possible to run SSL and non-SSL web applications on same standalone Wildfly?是否可以在同一个独立 Wildfly 上运行 SSL 和非 SSL Web 应用程序?
【发布时间】:2014-10-03 10:54:24
【问题描述】:

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

我正在使用 Wildfly 8.1.0 (Undertow),但在配置此场景时遇到了麻烦... 例如,我知道如何自己配置 HTTP 或 HTTPS,但是每当我尝试为两者运行配置时,HTTP 响应都会重定向到 SSL 的... :(

有人可以指出要更改的内容,例如在默认的standalone.xml 中吗?

【问题讨论】:

    标签: ssl jboss war wildfly


    【解决方案1】:

    是的,这是可能的。

    首先你需要在 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>
    

    那么你需要为 http 和 https 添加 lisner

    <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。

    【讨论】:

    • 感谢@Moes 的示例,我现在正在尝试使用它。但是为什么要为 HTTP ApplicationRealm 添加 SSL 配置?编辑:我看到只有 1 个应用程序领域,我被你的“两者”弄糊涂了
    • 这是拼写错误。正确的句子是“首先你需要在 ApplicationRealm 中添加波纹管代码”。如果有效,请将其标记为答案。
    • 是的,我确认它有效,谢谢!在另一个配置文件中,我有您提到的自动重定向,这是不希望的。附:请修正答案错字
    猜你喜欢
    • 2019-04-23
    • 2016-12-12
    • 1970-01-01
    • 2017-05-30
    • 2016-01-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多