【问题标题】:AWS API Gateway : Use 302 redirect and set-cookie headerAWS API Gateway:使用 302 重定向和 set-cookie 标头
【发布时间】:2016-02-24 07:19:11
【问题描述】:

我使用 AWS API Gateway 进行响应重定向。

简单流程: aaa.com ====> API 网关和 Lambda ==[302 重定向]==> bbb.com

关注the blog 时效果很好。但是,我无法在 bbb.com 设置 cookie。

我关注了博客并定义了另一个“Set-Cookie”标题。下面列出了我的 Lambda 代码 sn-p。

context.succeed({
    location : "http://192.168.173.193:3030",
    setCookie: "path=/;sessionID=1234;domain=null;"
});

【问题讨论】:

    标签: amazon-web-services setcookie http-status-code-302


    【解决方案1】:

    您是否更新了响应参数?

    在该博客文章中,请注意 Swagger 示例的 responseParameters 部分。

    responseParameters:
              method.response.header.Location: "integration.response.body.location"
    

    您需要在映射Set-Cookie 参数时添加另一行。比如:

    responseParameters:
              method.response.header.Location: "integration.response.body.location"
              method.response.header.Set-Cookie: "integration.response.body.setCookie"
    

    【讨论】:

      猜你喜欢
      • 2022-10-06
      • 2016-03-05
      • 1970-01-01
      • 1970-01-01
      • 2017-02-07
      • 1970-01-01
      • 2011-06-16
      • 2021-05-22
      • 2013-02-12
      相关资源
      最近更新 更多