Nginx X-Frame-Options

时间:2015-11-01 15:49:23

标签: ruby-on-rails nginx centos

我在centOS 6.7下使用nginx 1.8.0,它提供Ruby On Rails 4.2.3应用程序。

问题:

我需要为所有域启用iframe选项,所以尝试了这个:

X-Frame-Options: *

然后当我检查标题时,我在SAMEORIGIN一次看到它两次,在*看到一次,这是响应:

HTTP/1.1 200 OK
Server: nginx/1.8.0
Date: Sun, 01 Nov 2015 15:48:32 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Status: 200 OK
Strict-Transport-Security: max-age=31536000
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
ETag: W/"d14b3de05fb18ebe4a94774c8f209e7f"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: guess_locale=en; path=/; secure
Set-Cookie: _admin_numgames_com_session=Y3N0QjR2NXY0VFlZMlVnMHJLZC9WbUVraldZYjhpeHo0UG41akpaZE1rb0tQWS9YeGpkcklTRmViUU5aVmJpUElCcWpMaFJWQmpIWHRSazI4TE9QdTgvQ2VVRGYrSW9VcjA4eWVCMVlsUHJRejR1WmNoQWZoL2hGeVA1ZHp5YWxPdFZ4S25ydEtTamVnbFlZMEhJRDdXalQ2MU93T24vWnR6b28wM0NvYS82Nm1XMGV2Njh4djIzR1RNb2w3WTVHUDM3cVl3NnVrQnJ1WTMyU3I4dVBjY3RORWRQSlk2VmhNVnRVelZRbHRVWT0tLU9DYVBIZUxoUXlLN2VmZ01VNEhab3c9PQ%3D%3D--fa2a9d6817b5464b82a2babd784ed098f2526eeb; path=/; secure; HttpOnly
X-Request-Id: 4762503a-a9a8-41ce-b1a7-26269b7e9184
X-Runtime: 0.963198
X-Frame-Options: *

只有一次声明这个选项,为什么我看到它两次?以及如何删除此选项,以便任何人都可以将我的域名与iFrame一起使用?

1 个答案:

答案 0 :(得分:1)

好的,所以我发现解决方案和Rails是他发送标题的问题,只需要添加到production.rb文件中:

config.action_dispatch.default_headers = {
    'X-Frame-Options' => 'ALLOWALL'
}