但是如果你需要禁用这个头,尝试你的第一个代码没有引号在
我试图从服务器响应中删除X-Frame-Options,但它不起作用。Nginx version 1.17.8.
使用proxy_pass。我确实这样尝试过:
proxy_hide_header 'x-frame-options';
:
add_header X-Frame-Options "";
我也尝试了headers-more-nginx-module:
more_set_headers "x-frame-options";
:
more_clear_headers "X-Frame-Options";
more_clear_headers "x-frame-options";
和我总是得到一个错误,当我试图渲染页面在iframe:
Refused to display 'URL_PAGE' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
Curl -I result:
HTTP/2 200
accept-ranges: bytes
content-security-policy: frame-src 'self' *;
content-type: text/html
date: Thu, 09 Sep 2021 16:50:50 GMT
strict-transport-security: max-age=15552000; includeSubDomains; preload
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
任何想法?
使用特定的URL会更安全,例如:add_header X-Frame-Options "Allow-From URL";
URL应该是你的URL,需要在它上面做一个Iframe。
但是如果你需要禁用这个头,尝试你的第一个代码没有引号在
/etc/nginx/sites-available/default
像这样:proxy_hide_header x-frame-options;
然后重新启动服务器。