我正在尝试测试响应式设计。我正在使用 Rails 4。 我知道它将“X-Frame-Options”设置为“SAME ORIGIN”。所以我在development.rb中使用覆盖它
config.action_dispatch.default_headers = {
'X-Frame-Options' => 'ALLOWALL'
}
并且成功了。我在Chrome控制台查看了网络请求,如下:
但是像responsive.is和responsinator.com这样的网站仍然给我以下错误:
Refused to display 'http://localhost:3000/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'. about:blank:1
这是怎么回事?
最佳答案
尝试删除此 header “X-Frame-Options”。 也许在 Controller 中这样:
before_filter :allow_iframe_requests
...
def allow_iframe_requests
response.headers.delete('X-Frame-Options')
end
关于ruby-on-rails - 无法在 iframe 中显示我的 Rails 4 应用程序,即使 'X-Frame-Options' 是 'ALLOWALL',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17542511/