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
Actually, it seems you can access to all the headers provided by the original response (if it contains a Content-type, then you can type : integration.response.header.Content-type). However, I have not find out any way to add a new header (except statically).
From the AWS developer forums today (25 September 2015) this isn't possible yet, but may be coming in the future:
API Gateway does not currently support mapping from the integration response body to the response headers, but we are looking to add support for this in the future.
Forum post here
Edit December 2015: Feature as been added according to a post by an AWS employee in the thread linked above. Thanks to Peter Fox for pointing that out.
I know it has been a while since this was asked but you can now set:
integration.response.header.Location (note Uppercase L in Location) in Mapping value if you are setting it in response headers.
Example
Today (12th, November, 2015), I was looking for how to pass the Location header from my backend API to a Location header in integration response.
This configuration worked and I could get Location header from backend api:
Looks like the solution proposed by Tobias is possible currently. However, the Location header points to the backend API and this is not what we want. I'll try to find a solution for this and post it here.
As of today (January 2016), it works by simply specifying integration.response.body.Location
in your case.