I would like to make available a view of my Rails application via iFrame from any domain.
In Rails 4, there is a protection against X-Frame from other domains, as explained here: http://edgeguides.rubyonrails.org/security.html#default-headers
So, the solution would be to put this in application.rb:
config.action_dispatch.default_headers = {
'X-Frame-Options' => 'ALLOWALL'
}
This works nicely, both in my local server and in Heroku. But leaves all the views of the web application exposed to be called with an iframe from any domain.
And I would want to expose only the iframe view. So, instead of the previous solution, I tried configuring the header only within the controllet that I use to generate the iframe view:
def iframe
response.headers["X-Frame-Options"] = "ALLOWALL"
...
end
And it works well in my local server. But it does not work when I upload it to Heroku.
Any idea why the second solution does not work in Heroku?
Thank you