大网数据广告活动
服务器运维问答

Nginx X-Frame Options, Iframe Wordpress

· 52CE 我爱测

Using Wordpress on Nginx. I am receiving these errors but I can't seem to find out where in my Nginx options I have specified this 'DENY' header. Multiple 'X-Frame-Options' headers with conflicting values ('SAMEORIGIN, DENY') enc…

问题原文

原帖链接 · JoaMika · CC BY-SA 3.0

Using Wordpress on Nginx.

I am receiving these errors but I can't seem to find out where in my Nginx options I have specified this 'DENY' header.

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.

Any ideas?

In the core files of wordpress functions.php I can see

 * 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' );
}

But I guess that's not the problem since other users would have mentioned it.

已采纳解答

原帖链接 · Jonah Benton · CC BY-SA 3.0

Similar problem was posted to:

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

Answer copied here for future reference, from

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

There is duplicate setting in two places for the same config.

I removed the duplicate entry in

/etc/nginx/site-available/default 

config file.

Updated my

/etc/nginx/snippets/ssl-dhparams.conf 

to:

#add_header X-Frame-Options DENY;
add_header X-Frame-Options SAMEORIGIN;

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-09-07)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。