Access response headers in HTTP Fetch API with Serverless Framework and AWS Lambda
In order to access response headers such as Location
in HTTP Fetch api whilst
using Serverless Framework and AWS Lambda Functions with CORS enabled, you need
to do the following.
Make sure cors
is set to true
on serverless.yml
Make sure in the response header, you are returning the following:
Now, you can access the header location
from fetch
.
References:
Photo by Paul Buffington on Unsplash