问题
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