You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Patrick Valsecchi (JIRA)" <ji...@apache.org> on 2016/03/14 08:48:33 UTC

[jira] [Created] (CAMEL-9702) CORS support in servlet

Patrick Valsecchi created CAMEL-9702:
----------------------------------------

             Summary: CORS support in servlet
                 Key: CAMEL-9702
                 URL: https://issues.apache.org/jira/browse/CAMEL-9702
             Project: Camel
          Issue Type: Bug
          Components: camel-servlet
    Affects Versions: 2.16.2
         Environment: tomcat
            Reporter: Patrick Valsecchi


I'm trying to have CORS working with with the REST DSL (I'm actually using XML) in a servlet context (to run under tomcat).

I've put enableCORS="true" at the <rest> level and in all my <put> and <get> elements. That seems to work fine as long as I only do GET and PUT queries. The problem is that web clients have to do OPTIONS queries when some criteria are not met. And OPTIONS queries are not returning the required headers (Access-Control-Allow-Origin and Access-Control-Allow-Methods mainly). I just have a weird Allow header.

After trying to add an <options> section in my <rest> section to handle that manually, I've quickly figured out that they where never called. Then I've looked at the code and seen that CamelServlet.service is directly handling the OPTIONS query and is never forwarding them to the consumer. So it seems it's impossible to properly handling CORS queries with my setup.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)