I was digging web and kept trying to find what I am missing in the following situation: The basic problem I am trying to solve is: when http://example.com/login?target=http://google.com is called, the user is redirected to an OAuth login page with the state referring to the url in the target query param.
So: http://example.com/login?target=http://google.com
would be redirected to
http://authenticator.com/login?type=...&redirect_uri=...&client_id=...&state=http://google.com
I could do this with Lambda, but I felt it is unnecessary and API Gateway could be used solely.
First I created the /login resource and a GET method, to which I added a mock integration.
I set 302 at Method Response:
Finally I added Integration Response:
However when I test the method, the Location header is missing. If I put a static string to the Location header in Integration Response it works, but whatever I try at the header mapping it is not working.
Things I tried at Integration Request mapping:
{
"statusCode": 200,
"headers": {"target": "https://google.com"}
}
{
"statusCode": 200,
"target": "https://google.com"
}
I seems that integration.response.body.target or integration.response.header.target is always empty.
According to the documentation, headers property can be part of the integration response, but I cannot get any value from the Mapping Template I set at Integration Request.
Any idea what I did incorrectly?


