2

add_header X-Frame-Options DENY;似乎对我们不起作用。

我们打算将我们的托管页面之一显示为 PCI 相关问题的 iframe,我们成功了,但为了避免点击劫持,我们建议使用x-frame-options DENY但我们不能这样做,因为我们希望我们的用户使用框架我们开发了,所以解决方案可能是使用x-frame-options ALLOW FROM uri.

我们正在尝试add_header X-Frame-Options DENY;查看我们的应用程序是否首先限制了 iframe,但 iframe 仍然可见。我们多次验证了 add header 是否在 nginx conf 中的位置错误,但事实并非如此。

PS下面的图片是参考的,但我们仍然可以看到角度应用程序成功地渲染了框架:(

否定

4

3 回答 3

1

在nginx.conf的location块下添加以下代码

add_header X-Frame-Options "DENY" always;

例子

 location / {
        expires -1;
        add_header Pragma "no-cache";
        add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0, post-check=0, pre-check=0';
        add_header X-Frame-Options "DENY" always;
        root  <root directory>;
        index  index.html index.htm;
        try_files $uri $uri/ /index.html?$args;
   }
于 2021-01-18T14:59:33.740 回答
0

您可能使用的是旧浏览器,因为它可以在 Chrome 68 中运行。您可以检查 Javascript 错误和带有F12.

<iframe src="https://www.facebook.com"></iframe>

于 2019-01-28T12:34:16.233 回答
0

假设您的托管页面位于 URI1 中,而您的托管页面位于 URI2 中

当您发送 GET 请求以直接获取 URI1 时,响应标头是什么?

我认为您将“x-frame-option”添加到 URI2 而不是 URI1 的响应中

于 2019-02-02T23:09:31.167 回答