openstreetmap-website/config/initializers/cors.rb
2012-10-22 19:11:52 +01:00

13 lines
537 B
Ruby

require "rack/cors"
# Allow any and all cross-origin requests to the API. Allow any origin, and
# any headers. Non-browser requests do not have origin or header restrictions,
# so browser-requests should be similarly permitted. (Though the API does not
# require any custom headers, Ajax frameworks may automatically add headers
# such as X-Requested-By to requests.)
Rails.configuration.middleware.use Rack::Cors do
allow do
origins "*"
resource "/api/*", :headers => :any, :methods => [:get, :post, :put, :delete]
end
end