# For single ip address. Change the IP address to your needs
<Directory "/path/to/the/folder/which/needs/to/have/this/feature">
<If "%{REMOTE_ADDR} == '127.0.0.1'">
Header always unset HeaderName
</If>
</Directory>
# For multiple IP addresses, remove the top one, and use this one, and change the IP addresses
# to your needs, and add more '||' to use more IP addresses.
<Directory "/path/to/the/folder/which/needs/to/have/this/feature">
<If "%{REMOTE_ADDR} == '127.0.0.1' || %{REMOTE_ADDR} == '1.2.3.4'">
Header always unset HeaderName
</If>
</Directory>
您可以使用以下配置根据 IP 地址取消设置标头:
确保 mod_headers 已启用。有关更多详细信息,请查看https://httpd.apache.org/docs/2.4/mod/core.html#if和https://httpd.apache.org/docs/2.4/expr.html。
您可以根据需要对其进行配置,但要小心,并确保您没有为除您自己之外的所有人禁用 CSP 之类的标头。