I have two ring sites: mysite.com
and api.mysite.com
. api.mysite.com
has the ring-cors
middleware enabled:
(def app
(-> (make-handler v1-routes)
(wrap-defaults api-defaults)
(wrap-cors :access-control-allow-origin [#".*"]
:access-control-allow-headers ["Content-Type"]
:access-control-allow-methods [:get :put :post :delete :options])))
When I do a GET
or POST
request, the preflight succeeds but the GET
or POST
fails with:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://api.site.com/v1/site. (Reason: CORS header 'Access-Control-Allow-Origin' missing).
I can see in the debugger that Access-Control-Allow-Origin
is included in the OPTIONS
response but not in the subsequent GET
or POST
response.
Any idea what's up? My app is a bit complex and also has bidi
, liberator
, and some hosts
file and nginx
stuff going on. I think those can be put aside for now and the issue traced to some problem with the middleware or middleware configuration.