How do I get Sinatra to refrain from adding the X-Frame-Options header?

后端 未结 6 1815
南旧
南旧 2020-12-08 04:55

I am using Sinatra to return some IFRAME contents, and I\'d like to allow cross-domain src. Unfortunately, Sinatra is automatically adding an X-Frame-Options header to my re

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-08 05:23

    The "set :protection, :except => :frame_options" answer did not work for me, using Sinatra-1.3.3

    I had to hack a solution; I put this mutha in my config.ru file. Obvs you can change the header to be anything you want.

    config.ru

    class Rack::Protection::FrameOptions
      def header
        @header ||= {}
      end
    end
    

提交回复
热议问题