AWS API Gateway:使用302重定向和set-cookie标头 [英] AWS API Gateway : Use 302 redirect and set-cookie header

查看:345
本文介绍了AWS API Gateway:使用302重定向和set-cookie标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I used AWS API Gateway to redirect in response.

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

simple flow : aaa.com ====> API Gateway & Lambda ==[302 redirect]==> bbb.com

当遵循博客.但是,我无法在 bbb.com 上设置cookie.

It worked well when following the blog. However, I couldn't set cookie at bbb.com.

我关注了博客,并定义了另一个"Set-Cookie"标题.我的Lambda代码段在下面列出.

I followed the blog and defined another "Set-Cookie" header. My Lambda code snippet listed below.

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

推荐答案

您是否更新了响应参数?

Did you update your Response Parameters?

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

In that blog post notice the responseParameters section of the Swagger Example.

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

您需要向映射Set-Cookie参数的那一行添加另一行.像这样:

You need to add another line to that mapping the Set-Cookie parameter. Something like:

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

这篇关于AWS API Gateway:使用302重定向和set-cookie标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆