Below is code i used to set cookie and redirect link at a single response but only either will work. If statusCode is 301/302 the redirection is happening but cookie is not set. If statusCode is 200 cookie is set but redirect is not working. Does anyone know how to use both in a single request ? Should i change the StatusCode some status code dont allow setting cookie ?
const response = {
statusCode: 302,
headers: {
"Access-Control-Allow-Origin" : "*",
"Access-Control-Allow-Credentials" : true,
"Set-Cookie": 'data='+data,
"Location":"http://localhost:8040/#/dashboard",
},
body: JSON.stringify({
message: data,
}),
};
callback(null, response);
I am using serverless framework of nodejs.