Apigee Pre-Flight Options Requests-open source projects flightjs/flight
I create api proxies and check the box that says “Enable Direct Browser Access for Your API — Allow direct requests from a browser via CORS.” but my OPTIONS requests are still failing with :
{
"fault": {
"faultstring": "Received 405 Response without Allow Header",
"detail": {
"errorcode": "protocol.http.Response405WithoutAllowHeader"
}
}
}
From what I understand about CORS Pre-Flight Options requests, the client first sends the OPTIONS request to the server as a safeguard for “safe” CORS. This request should return a response with the list of request types that are available.
My Question: How do I make it so that Apigee responds correctly to OPTIONS requests and does not pass the OPTIONS request to my api behind the proxy?. If it helps I have AngularJS javascript apps trying to communicate with my Apigee endpoint.
Javascript errors:
OPTIONS http://api.example.com No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://client.example.com' is therefore not allowed access.
XMLHttpRequest cannot load http://api.example.com. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://client.example.com' is therefore not allowed access.
Default “Add CORS” xml
Add CORS
*
origin, x-requested-with, accept
3628800
GET, PUT, POST, DELETE
true
Default Proxy Endpoints xml
/v1/cnc
default
secure
default
Default Target Endpoint xml
Add-CORS
http://api.example.com/v1/assets.json