配置Jboss管理控制台URL的HTTP标头

hpxqektj  于 2022-11-08  发布在  其他
关注(0)|答案(1)|浏览(180)

当在undertow中配置过滤器以应用某些http响应头时,这些头只会出现在http和https端口上,而不会出现在management-http和management-https端口上。是否有办法也为管理控制台配置相同的头?以下是我的当前配置

<subsystem xmlns="urn:jboss:domain:undertow:7.0">
            <buffer-cache name="default"/>
            <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" enabled-protocols="TLSv1.2" />
                <host name="default-host" alias="localhost">
                    <location name="/" handler="welcome-content"/>
                    <filter-ref name="server-header"/>
                    <filter-ref name="x-powered-by-header"/>
                    <filter-ref name="x-xss-protection"/>
                    <filter-ref name="x-content-type-options"/>
                    <filter-ref name="strict-transport-security"/>
                    <http-invoker security-realm="ApplicationRealm"/>
                </host>
            </server>
            <servlet-container name="default">
                <jsp-config/>
                <websockets/>
            </servlet-container>
            <handlers>
                <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
            </handlers>
            <filters>
                <response-header name="server-header" header-name="Server" header-value="JBoss-EAP/7"/>
                <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
                <response-header name="x-xss-protection" header-name="X-XSS-Protection" header-value="1; mode=block"/>
                <response-header name="x-content-type-options" header-name="X-Content-Type-Options" header-value="nosniff"/>
                <response-header name="strict-transport-security" header-name="Strict-Transport-Security" header-value="max-age=31536000; includeSubDomains"/>
            </filters>
        </subsystem>

**管理/管理控制台的标题:**x1c 0d1x
应用程序的标题:

w6lpcovy

w6lpcovy1#

此功能可从JBOSEAP7.3获得。对于独立模式配置,

<management-interfaces>
        <http-interface security-realm="ManagementRealm">
            <http-upgrade enabled="true"/>
            <socket-binding http="management-http"/>
            <constant-headers>
                <header-mapping path="/management">
                    <header name="X-Header" value="HeaderValue"/>
                </header-mapping>
                <header-mapping path="/management">
                    <header name="Y-Header" value="HeaderValue2"/>
                </header-mapping>
            </constant-headers>
        </http-interface>
    </management-interfaces>

对于host.xml中的域模式配置,

<management-interfaces>
        <http-interface security-realm="ManagementRealm">
            <http-upgrade enabled="true"/>
            <socket interface="management" port="${jboss.management.http.port:9990}"/>
            <constant-headers>
                <header-mapping path="/management">
                    <header name="X-Header" value="HeaderValue"/>
                </header-mapping>
                <header-mapping path="/management">
                    <header name="Y-Header" value="HeaderValue2"/>
                </header-mapping>
            </constant-headers>
        </http-interface>
    </management-interfaces>

相关问题