【发布时间】:2020-11-12 00:04:05
【问题描述】:
当在 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>
【问题讨论】:
-
undertow 子系统没有暴露管理服务器。
-
@ehsavoie 还有其他方法可以实现吗?
-
您需要/想要什么阅读器?我不确定这目前是否容易实现。
-
比如我想添加 X-XSS-Protection: 1; mode=block 也适用于管理控制台。
标签: http jboss header jboss-eap-7 response-headers