Skip to content

Commit 2ff4d6a

Browse files
committed
Add Cross-Origin-Opener-Policy header
Reported-by: Sam Jose <samjosep512@gmail.com>
1 parent 848598f commit 2ff4d6a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module OpenStreetMap
2+
module Rack
3+
class PolicyHeaders
4+
COOP_HEADER = "Cross-Origin-Opener-Policy".freeze
5+
6+
def initialize(app)
7+
@app = app
8+
end
9+
10+
def call(env)
11+
status, headers, response = @app.call(env)
12+
headers[COOP_HEADER] = "same-origin" unless headers.key?(COOP_HEADER)
13+
[status, headers, response]
14+
end
15+
end
16+
end
17+
end
18+
19+
Rails.configuration.middleware.use OpenStreetMap::Rack::PolicyHeaders

0 commit comments

Comments
 (0)