Amazon API gateway ignores set-cookie from back-end API

时间:2016-07-11 19:25:52

标签: node.js session amazon-web-services cookies aws-api-gateway

I am trying to set up http-proxy using amazon api gateway, but the set-cookie request from back-end api is ignored by api gateway. Also I have tried to include "integration.response.header.Set-Cookie" as mapping for "set-cookie" in gateway.

what setting I have to follow so that gateway does not filter out any header-request parameters like set-cookie & cookie

1 个答案:

答案 0 :(得分:1)

API Gateway does not filter the Cookie or Set-Cookie header on the request or response. You should be able to proxy these headers to your endpoint and back again without issue.

However, the cookie headers may be filtered out by the "test invoke" function in the API Gateway console, or the test client that you may be using.

To confirm please test against a deployed API using a supported client such as curl. i.e.

curl -v "https://h8q79qwil5.execute-api.us-east-1.amazonaws.com/test"
*   Trying 52.84.24.209...
* Connected to h8q79qwil5.execute-api.us-east-1.amazonaws.com (52.84.24.209) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: *.execute-api.us-east-1.amazonaws.com
* Server certificate: Symantec Class 3 Secure Server CA - G4
* Server certificate: VeriSign Class 3 Public Primary Certification Authority - G5
> GET /test HTTP/1.1
> Host: h8q79qwil5.execute-api.us-east-1.amazonaws.com
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Length: 181
< Connection: keep-alive
< Date: Mon, 11 Jul 2016 22:36:21 GMT
< Cookie: foobar
< Set-Cookie: set-cookie!
< x-amzn-RequestId: e40c57d1-47b7-11e6-b175-2f2f5356f0d7
< X-Cache: Miss from cloudfront
< Via: 1.1 ce270f4a88edde7438864bc44406e83a.cloudfront.net (CloudFront)
< X-Amz-Cf-Id: BRoLbquwa2ZkOwxDcEOJQ-iheYa90AM4WkT2gZr3TUgLlBIvUijZAg==

Thanks, Ryan