【问题标题】:Cannot change X-Frame-Options to SAMEORIGIN无法将 X-Frame-Options 更改为 SAMEORIGIN
【发布时间】:2019-12-12 11:00:53
【问题描述】:

我需要在 iframe 中显示我的网站内的页面,但出现错误:

这里是我的 nginx.conf 文件,我在下面添加了 add_header 执行了多次服务器重启

--> nginx.conf

        worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile off;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

 add_header X-Frame-Options SAMEORIGIN;

}


#mail {
#   # See sample authentication script at:
#   # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
# 
#   # auth_http localhost/auth.php;
#   # pop3_capabilities "TOP" "USER";
#   # imap_capabilities "IMAP4rev1" "UIDPLUS";
# 
#   server {
#       listen     localhost:110;
#       protocol   pop3;
#       proxy      on;
#   }
# 
#   server {
#       listen     localhost:143;
#       protocol   imap;
#       proxy      on;
#   }
#}

这仍然会提供一个带有

的页面

似乎没有任何改变,我已经用谷歌搜索并搜索了几个小时,但无法找到有效的解决方案。

【问题讨论】:

    标签: node.js express nginx digital-ocean x-frame-options


    【解决方案1】:

    好的,所以我在 conf 文件中发现了我的问题:/etc/nginx/sn-ps/ssl-params.conf

    包含:add_header X-Frame-Options DENY;

    只需使用 #add_header X-Frame-Options DENY 将其注释掉即可;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-03-21
      • 1970-01-01
      • 1970-01-01
      • 2021-05-09
      • 2018-05-27
      • 2016-07-12
      • 2013-08-10
      相关资源
      最近更新 更多