Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-9702

CORS support in servlet

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.16.2
    • Fix Version/s: 2.17.0
    • Component/s: camel-servlet
    • Labels:
      None
    • Environment:

      tomcat

    • Estimated Complexity:
      Unknown

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              pvalsecc Patrick Valsecchi
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: