I am trying to test a responsive design. I am using Rails 4. I know it sets 'X-Frame-Options' to SAME ORIGIN. So I overrided it in development.rb using

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

and it worked. I checked out the network request in the Chrome console and it is as follows:

enter image description here

But still websites like responsive.is and responsinator.com give me below error:

Refused to display 'http://localhost:3000/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'. about:blank:1

Whats going on??

推荐答案

I had the same problem as you, and searched for a solution to this problem all night.

I finally found out why it happens. It's because of the Chrome cache.

You can see the header['X-Frame-Options'] is ALLOWALL but it doesn't work.

Just try to open a "New Incognito Window" and go the same page and it works!

This problem only happened in development mode in my test. It worked fine in production mode.

Ruby-on-rails相关问答推荐

包含字母和数字组合的正则表达式

Rails ActiveRecord::LogSubscriber 不输出详细查询日志(log)

无法在 Rails 中使用 wkhtmltopdf 写入临时文件

ArgumentError 用于 Ruby on Rails 中非常简单的初始化方法,没有参数

Rails 3 应用程序的 MySQL 集群 (NDB) 与 MySQL 复制 (InnoDB):优点/缺点?

你能从 Heroku dynos/workers 中获得多少性能?

如何在 Ruby on Rails 中创建一个锚点并重定向到这个特定的锚点

在一行中更改多个对象属性

FactoryGirl + Faker - 为数据库种子数据中的每个对象生成相同的数据

如何在 ruby​​ on rails 中获取控制器和操作列表?

如何在 Rails 上生成 AuthenticityToken

没有图像时如何在回形针中显示隐藏图像

bundle和gem安装的区别?

在 ID 存在时获取表的未知主键

如何在Ruby 中对数字进行上限和舍入

Rails 3.1 插件 gem、虚拟测试应用程序、rspec

按周/月/等和 ActiveRecord 分组?

Rails 3.1 Sprockets 需要指令 - 有没有办法排除特定文件?

ruby/ruby on rails 内存泄漏检测

如何从另一个调用 Capistrano 任务?