AWS API Gateway : Use 302 redirect and set-cookie header

岁酱吖の 提交于 2019-12-22 08:35:30

问题


I used AWS API Gateway to redirect in response.

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

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

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;"
});

回答1:


Did you update your Response Parameters?

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

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

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"


来源:https://stackoverflow.com/questions/35595672/aws-api-gateway-use-302-redirect-and-set-cookie-header

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!