I'm trying to map the JSON output from a Lambda function to the header of an API Gateway call. As an example here, we can consider a redirect scenario. So I'd like to add a Location
header to the response from my API Gateway call.
JSON output from Lambda function:
{
Location: 'http://google.com'
}
In "Method Response"->"Response Headers" I can add the Location
header to the desired HTTP status code.
Then in "Integration Response"->"Header Mappings" I can add the mapping for the Location
header to be something.
Now my question is what should this something be?
Note: I've tried integration.response.header.Location
, or using "Mapping Templates" but no luck so far.
There's a chance that it might not be possible at the moment (https://forums.aws.amazon.com/thread.jspa?messageID=651482), but since API Gateway/Lambda are evolving so quickly at the moment I'll ask anyway.
Map the output from your Lambda function to the headers and output model of the 200 method response.
This statement from the Integration response screen in API Gateway makes it look like it should be possible. But unable to find out how. – user3526