WildFly 9:仅对本地主机允许HTTP

时间:2018-09-28 08:30:23

标签: http https localhost wildfly

我们从JBoss 7迁移到WildFly 9.0.2,使用SSL / HTTPS时遇到了问题。 HTTPS-Configuration可以工作,但是我们需要特殊的配置,即仅适用于本地主机的HTTP可用。

在JBoss 7中,我们做到了:

1。

<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
change to
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="system-http"/>

2。

<virtual-server name="default-host" enable-welcome-root="false">
...
add server name
<alias name="servername"/>

3。

<interfaces>
...
add
<interface name="system">
    <inet-address value="127.0.0.1"/>
</interface>

4。

<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
...
<socket-binding name="http" port="8080"/>
change to
<socket-binding name="system-http" port="8080"/>

在WildFly中,我们做到了:

1。和2。

<subsystem xmlns="urn:jboss:domain:undertow:2.0">
        <buffer-cache name="default"/>
        <server name="default-server">
            <http-listener name="http" socket-binding="system-http"/>
            <https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" />
            <host name="default-host" alias="localhost,servername">
                <location name="/" handler="welcome-content"/>
                <filter-ref name="server-header"/>
                <single-sign-on path="/"/>
            </host>
        </server>

3。一样

4。

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

但是它不起作用(404)。 有什么想法吗?

2 个答案:

答案 0 :(得分:0)

看[1]并尝试以其他方式表达您的需求,例如:

  • 尝试在inet-address中使用主机名“ localhost”(或在/ etc / hosts中配置的任何内容)
  • 尝试使用loppback属性

[1] https://wildscribe.github.io/WildFly/9.0/interface/index.html

答案 1 :(得分:0)

我不知道为什么,但是现在可以了!也许端口或别名设置不正确。 感谢Martin Choma!