Search code examples
cookiessetcookieaws-appsync

AppSync: How set header in response?


I want to authorize the user through http only cookies.

I want to set header in the AppSync response as example "Set-Cookie": "cookie=cookie; HttpOnly"

in "Configure the response mapping template" I have $util.toJson($context.result)

How can I do that?


Solution

  • It seems that Appsync doesn't allow you to pass the request cookie header to a lambda. You can pass other headers like authorize or x-api-key or cookies but cookie seems to get stripped from the event. I haven't found anything in the documentation about this behavior but from observation, this is what is happening currently. You will need to pass your auth data in another header.