Hi,

Do you think that its is possible to reply to an OPTIONS request with Camel
REST DSL ?

When swagger ui sends a POST/PUT/DELETE request and that a different http
server issue the request, then it will first send an OPTIONS preflight
request (https://github.com/swagger-api/swagger-ui/issues/44,
https://groups.google.com/forum/#!topic/swagger-swaggersocket/cefgOB0S82M)

Obviously, such a request will not return CORS headers as we can't define
OPTIONS as operation using RES DSL

curl -I -X OPTIONS http://localhost:9191/blog/articles/1
HTTP/1.1 404 Not Found
Cache-Control: must-revalidate,no-cache,no-store
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 1282
Server: Jetty(8.1.17.v20150415)

and by consequence, a CORS error will be generated

XMLHttpRequest cannot load http://localhost:9191/blog/article/2. No
'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:8000' is therefore not allowed access. The
response had HTTP status code 404.

Is there a workaround ?

Regards,

-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io

Reply via email to