Sorry, not sure if you are suggesting the same, but IMHO there should be
a way to optionally delegate to the underlying REST DSL consumer to
handle OPTIONS, even though it won't be for the purpose of starting a route.
Specifically, in CXF JAX-RS we have a very good CORS filter, I'm
presuming other REST DSL providers will have similar support, etc...
Sergey
On 11/09/15 13:07, Charles Moulliard wrote:
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,
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/