Rails Changing X-Frame-Options

牧云@^-^@ 提交于 2020-01-01 10:11:49

问题


Sorry for such a noob question, but I am just not figuring this out. I'm playing around with a Rails server, and for now I need to embed it in an iFrame. I've seen here and here how to change the x-frame options, but for the life of me I can't find out where I need to actually go to do this. I'm not sure if I need to just stick this somewhere in my app config file, my rails config file (which seems unlikely to me), but I'm obviously overlooking something.

(I don't know if this is necessary to know, but I'm running Ruby 1.9.3 and rails 4.0)

As always; thanks in advance everyone.


回答1:


You put it in the config/application.rb file. Open up the file and you should be able to see where to add it. I'm using

config.action_dispatch.default_headers.merge!({'X-Frame-Options' => 'ALLOWALL'})

so that the other default headers are preserved



来源:https://stackoverflow.com/questions/17668578/rails-changing-x-frame-options

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!