【问题标题】:Amazon API gateway ignores set-cookie from back-end APIAmazon API 网关忽略来自后端 API 的 set-cookie
【发布时间】:2016-11-13 20:33:40
【问题描述】:

我正在尝试使用 amazon api 网关设置 http-proxy,但来自后端 api 的 set-cookie 请求被 api 网关忽略。我还尝试将“integration.response.header.Set-Cookie”作为网关中“set-cookie”的映射。

我必须遵循什么设置,以便网关不会过滤掉任何标头请求参数,例如 set-cookie 和 cookie

【问题讨论】:

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


    【解决方案1】:

    API Gateway 不会过滤请求或响应中的 Cookie 或 Set-Cookie 标头。您应该能够将这些标头代理到您的端点并再次返回而不会出现问题。

    但是,cookie 标头可能会被 API Gateway 控制台中的“测试调用”功能或您可能正在使用的测试客户端过滤掉。

    要确认,请使用受支持的客户端(例如 curl)针对已部署的 API 进行测试。即

    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==
    

    谢谢, 瑞恩

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-18
      • 1970-01-01
      • 2021-01-26
      • 2014-10-15
      • 1970-01-01
      • 2021-05-22
      • 2018-06-14
      • 1970-01-01
      相关资源
      最近更新 更多