mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 05:08:09 +08:00
FEATURE: add site setting to remove X-Frame-Options
header.
This commit is contained in:
15
lib/middleware/frame_options.rb
Normal file
15
lib/middleware/frame_options.rb
Normal file
@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Middleware
|
||||
class FrameOptions
|
||||
def initialize(app, settings = {})
|
||||
@app = app
|
||||
end
|
||||
|
||||
def call(env)
|
||||
status, headers, body = @app.call(env)
|
||||
headers.except!('X-Frame-Options') if SiteSetting.allow_embedding_site_in_an_iframe
|
||||
[status, headers, body]
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user