1 # Be sure to restart your server when you modify this file.
3 # Mark CORS responses as uncacheable as we don't want a browser to
4 # try and reuse a response that had a different origin, even with
5 # revalidation, as the origin check will fail.
7 class Cors < Rack::Cors
9 status, headers, body = super env
10 headers["Cache-Control"] = "no-cache" if headers["Access-Control-Allow-Origin"]
11 [status, headers, body]
16 # Allow any and all cross-origin requests to the API. Allow any origin, and
17 # any headers. Non-browser requests do not have origin or header restrictions,
18 # so browser-requests should be similarly permitted. (Though the API does not
19 # require any custom headers, Ajax frameworks may automatically add headers
20 # such as X-Requested-By to requests.)
21 Rails.application.config.middleware.insert_before 0, OpenStreetMap::Cors do
24 resource "/oauth/*", :headers => :any, :methods => [:get, :post]
25 resource "/oauth2/token", :headers => :any, :methods => [:post]
26 resource "/oauth2/revoke", :headers => :any, :methods => [:post]
27 resource "/oauth2/introspect", :headers => :any, :methods => [:post]
28 resource "/api/*", :headers => :any, :methods => [:get, :post, :put, :delete]
29 resource "/diary/rss", :headers => :any, :methods => [:get]
30 resource "/diary/*/rss", :headers => :any, :methods => [:get]
31 resource "/trace/*/data", :headers => :any, :methods => [:get]
32 resource "/user/*/diary/rss", :headers => :any, :methods => [:get]