Nginx X-Frame 选项,Iframe Wordpress

Joa*_*ika 1 nginx x-frame-options

在 Nginx 上使用 Wordpress。

我收到这些错误,但我似乎无法找出在我的 Nginx 选项中我指定了这个“拒绝”标头的位置。

Multiple 'X-Frame-Options' headers with conflicting values ('SAMEORIGIN, DENY') encountered when loading 'https://beta.com/wp-admin/plugin-install.php?tab=plugin-information&plugin=duplicate-post&'. Falling back to 'DENY'.

Refused to display 'https://beta.com/wp-admin/plugin-install.php?tab=plugin-information&plugin=duplicate-post&' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN, DENY'.

load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery…:2 Uncaught SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Sandbox access violation: Blocked a frame at "https://beta.com" from accessing a frame at "null".  The frame being accessed is sandboxed and lacks the "allow-same-origin" flag.
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

在wordpressfunctions.php的核心文件中我可以看到

 * Send a HTTP header to limit rendering of pages to same origin iframes.
 *
 * @since 3.1.3
 *
 * @see https://developer.mozilla.org/en/the_x-frame-options_response_header
 */
function send_frame_options_header() {
    @header( 'X-Frame-Options: SAMEORIGIN' );
}
Run Code Online (Sandbox Code Playgroud)

但我想这不是问题,因为其他用户会提到它。

小智 6

类似的问题发布到:

https://wordpress.org/support/topic/multiple-x-frame-options-headers-with-conflicting-values-sameorigin-deny/

答案复制到这里以备将来参考,来自

https://wordpress.org/support/users/knnleow/

同一配置在两个地方有重复的设置。

我删除了重复的条目

/etc/nginx/site-available/default 
Run Code Online (Sandbox Code Playgroud)

配置文件。

更新了我的

/etc/nginx/snippets/ssl-dhparams.conf 
Run Code Online (Sandbox Code Playgroud)

到:

#add_header X-Frame-Options DENY;
add_header X-Frame-Options SAMEORIGIN;
Run Code Online (Sandbox Code Playgroud)