You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Wildfly 16使用DNS域名访问被拒,如何配置standalone.xml实现访问

Wildfly 16 域名访问异常配置修复方案

1 确认网络接口绑定配置

打开standalone.xml定位到<interfaces>配置块,确保public接口绑定的地址允许外部访问,推荐测试环境配置为绑定所有网卡:

<interfaces>
    <interface name="management">
        <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
    </interface>
    <interface name="public">
        <inet-address value="${jboss.bind.address:0.0.0.0}"/>
    </interface>
</interfaces>

如果生产环境需要指定绑定网卡,把0.0.0.0替换为对应网卡的实际IP即可。

2 配置Undertow子系统虚拟主机别名(核心修复步骤)

你的场景IP、主机名可访问但自定义域名被拒绝,90%以上是因为Undertow默认校验HTTP请求的Host头,只有配置在允许别名列表里的域名才能正常访问。
定位到Undertow子系统的default-host配置块:

<subsystem xmlns="urn:jboss:domain:undertow:8.0">
    <server name="default-server">
        <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
        <https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
        <!-- 此处为需要修改的host配置 -->
        <host name="default-host" alias="localhost">
            <location name="/" handler="welcome-content"/>
            <http-invoker security-realm="ApplicationRealm"/>
        </host>
    </server>
    <!-- 其余配置省略 -->
</subsystem>

在alias属性中追加你需要使用的所有DNS域名,多个域名用逗号分隔:

<host name="default-host" alias="localhost, test.mydomain.internal, test_instance.mydomain.internal">

3 可选:关闭Host头校验(仅测试环境使用)

如果不需要限制访问域名,可以直接关闭Host头校验功能,修改default-server配置添加属性:

<server name="default-server" disable-host-header-validation="true">

注意:该配置会允许任意Host头的请求进入,生产环境使用存在安全风险,不推荐开启。

修改完成后重启Wildfly实例即可生效。

内容的提问来源于stack exchange,提问作者Net_Hans

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.26 16:24:07