gpt4 book ai didi

security - 在 Wildfly 10 中配置 HTTP header

转载 作者:行者123 更新时间:2023-12-05 00:39:32 31 4
gpt4 key购买 nike

有没有办法配置Wildfly(10个或更多)发送给客户端的Http Headers仅配置以下内容:

HTTPS Strict Transport Security (HSTS) X-XSS-Protection X-Frame-Options Strict-Transport-Security Content-Security-Policy X-Content-Type-Options

我有一个配置文件(standalone.xml),其中包含所有配置。我需要在这里添加标题的配置。

最佳答案

    <subsystem xmlns="urn:jboss:domain:undertow:6.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http" max-parameters="10000" redirect-socket="https" enable-http2="true"/>
<https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content" predicate="not exists[%{o,Content-Security-Policy}]"/>
<http-invoker security-realm="ApplicationRealm"/>
<filter-ref name="Content-Security-Policy"/>
<filter-ref name="x-frame-options"/>
<filter-ref name="x-xss-protection"/>
<filter-ref name="x-content-type-options"/>
<!--filter-ref name="content-security-policy"/-->
<filter-ref name="strict-transport-security"/>
<filter-ref name="my-custom-header"/>
</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="Content-Security-Policy" header-name="Content-Security-Policy" header-value="default-src 'self'"/>
<response-header name="x-frame-options" header-name="X-Frame-Options" header-value="SAMEORIGIN"/>
<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="content-security-policy" header-name="Content-Security-Policy" header-value="default-src https:"/-->
<response-header name="strict-transport-security" header-name="Strict-Transport-Security" header-value="max-age=31536000; includeSubDomains;"/>
<!-- Add line below -->
<response-header name="my-custom-header" header-name="my-custom-header" header-value="my-custom-value"/>
</filters>
</subsystem>

关于security - 在 Wildfly 10 中配置 HTTP header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56272061/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com