camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stijn Van Bael (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CAMEL-8373) rest-dsl - CORS may have issue with non simple requests
Date Thu, 09 Apr 2015 14:26:13 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-8373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14487412#comment-14487412
] 

Stijn Van Bael edited comment on CAMEL-8373 at 4/9/15 2:25 PM:
---------------------------------------------------------------

I have a similar issue with netty4-http. The OPTIONS request only returns following headers:

    Allow: OPTIONS,GET
    Content-Length: 0
    Content-Type: text/plain


I tried working around it in a similar way Florian did:

    from("netty4-http:http://0.0.0.0:8081/products?matchOnUriPrefix=true&httpMethodRestrict=OPTIONS")
            .setHeader("Access-Control-Allow-Origin", constant("*"))
            .setHeader("Access-Control-Allow-Methods", constant("GET, HEAD, POST, PUT, DELETE,
TRACE, OPTIONS, CONNECT, PATCH"))
            .setHeader("Access-Control-Allow-Headers", constant("Origin, Accept, X-Requested-With,
Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers"))
            .setHeader("Allow", constant("GET, OPTIONS, POST, PATCH"));


but that makes things even more strange. None of the Access-Control-Allow-* headers are returned
and now Allow returns OPTIONS twice:

    Allow: OPTIONS,OPTIONS
    Content-Length: 0
    Content-Type: text/plain


was (Author: stijn.van.bael):
I have a similar issue with netty4-http. The OPTIONS request only returns following headers:

    Allow: OPTIONS,GET
    Content-Length: 0
    Content-Type: text/plain


I tried working around it in a similar way Florian did:

    from("netty4-http:http://0.0.0.0:8081/products?matchOnUriPrefix=true&httpMethodRestrict=OPTIONS")
            .setHeader("Access-Control-Allow-Origin", constant("*"))
            .setHeader("Access-Control-Allow-Methods", constant("GET, HEAD, POST, PUT, DELETE,
TRACE, OPTIONS, CONNECT, PATCH"))
            .setHeader("Access-Control-Allow-Headers", constant("Origin, Accept, X-Requested-With,
Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers"))
            .setHeader("Allow", constant("GET, OPTIONS, POST, PATCH"));


but that makes things even more strange. None of the Access-Control-Allow-* headers are returned
and now Allow only returns OPTIONS twice:

    Allow: OPTIONS,OPTIONS
    Content-Length: 0
    Content-Type: text/plain

> rest-dsl - CORS may have issue with non simple requests
> -------------------------------------------------------
>
>                 Key: CAMEL-8373
>                 URL: https://issues.apache.org/jira/browse/CAMEL-8373
>             Project: Camel
>          Issue Type: Task
>          Components: camel-core
>    Affects Versions: 2.14.1
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.15.2, 2.16.0
>
>
> Look into reported on SO
> http://stackoverflow.com/questions/28562817/camel-rest-dsl-enablecors-only-working-for-get
> For non simple requests, such as PUT see
> http://www.w3.org/TR/cors/



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

Mime
View raw message