Class: Rack::Cors::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/forest_liana/engine.rb

Instance Method Summary collapse

Instance Method Details

#to_preflight_headers(env) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/forest_liana/engine.rb', line 14

def to_preflight_headers(env)
  h = to_headers(env)
  h['Access-Control-Allow-Private-Network'] = 'true' if env['HTTP_ACCESS_CONTROL_REQUEST_PRIVATE_NETWORK'] == 'true'
  if env[HTTP_ACCESS_CONTROL_REQUEST_HEADERS]
    h.merge!('Access-Control-Allow-Headers' => env[HTTP_ACCESS_CONTROL_REQUEST_HEADERS])
  end
  h
end