Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 729D6200C36 for ; Fri, 10 Mar 2017 11:23:12 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 710AC160B79; Fri, 10 Mar 2017 10:23:12 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BBCC2160B69 for ; Fri, 10 Mar 2017 11:23:11 +0100 (CET) Received: (qmail 29651 invoked by uid 500); 10 Mar 2017 10:23:10 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 29642 invoked by uid 99); 10 Mar 2017 10:23:10 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Mar 2017 10:23:10 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 67D84C0912 for ; Fri, 10 Mar 2017 10:23:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.451 X-Spam-Level: * X-Spam-Status: No, score=1.451 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_NEUTRAL=0.652] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id m5vauAtk6Njk for ; Fri, 10 Mar 2017 10:23:09 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id EBF735F1EE for ; Fri, 10 Mar 2017 10:23:08 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 9C91CE06B9 for ; Fri, 10 Mar 2017 10:23:04 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 5691C243A6 for ; Fri, 10 Mar 2017 10:23:04 +0000 (UTC) Date: Fri, 10 Mar 2017 10:23:04 +0000 (UTC) From: "Claus Ibsen (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CAMEL-10913) CORS header Access-Control-Allow-Credentials not managed correctly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 10 Mar 2017 10:23:12 -0000 [ https://issues.apache.org/jira/browse/CAMEL-10913?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15904851#comment-15904851 ] Claus Ibsen commented on CAMEL-10913: ------------------------------------- Yeah so if that corsAllowCredentials = true then we set the origin to be Origin instead of * (if its a *) > CORS header Access-Control-Allow-Credentials not managed correctly > ------------------------------------------------------------------ > > Key: CAMEL-10913 > URL: https://issues.apache.org/jira/browse/CAMEL-10913 > Project: Camel > Issue Type: Bug > Components: camel-http-common > Reporter: Nicola Ferraro > Fix For: 2.19.0 > > > When a browser uses the "withCredentials" flag (not visible in HTTP request headers), it accepts the response only if the "Access-Control-Allow-Credentials" header returned by the server is set to "true". > That header is not part of Camel standard cors headers, but it can be set in the route. The problem is that when "Access-Control-Allow-Credentials" is set to "true", the "Access-Control-Allow-Origin" header cannot be set to "*", which is our default (https://www.w3.org/TR/cors/ - section 6.1, point 3). > Setting a value for the "Access-Control-Allow-Origin" header equals to the "Origin" header of the request makes the trick, but this must be set per-route, and *CORS must be disabled*. > Eg. > {code} > // do not enable cors > rest().get("/hello") > .route() > .to("direct:handle") > .setHeader("Access-Control-Allow-Credentials", constant("true")) > .setHeader("Access-Control-Allow-Origin", header("Origin")); > {code} > Otherwise the only option is setting a fixed allowed origin if you know it in advance. > I wonder if we should add e.g. a ".corsAllowCredentials(boolean)" configuration to handle this situation correctly, or another flag to reflect the origin instead of returning "*". -- This message was sent by Atlassian JIRA (v6.3.15#6346)