I have a lambda handler written in Python and I wish to perform a 301 redirect to the browser. I have no idea how I can configure the response Location
header (or the status code) -- the documentation doesn't seem to cover anything in context object other than some properties. Apparently context.succeed
works with Node JS but this doesn't help in Python.
Returning:
{"Location": "http://google.com/"}
causes the API gateway to report:
Fri Dec 09 16:20:53 UTC 2016 : Execution failed due to configuration error: Malformed Lambda proxy response
in the test console.
So, how do I perform a 301 redirect from a Python Lambda function when using API gateway and an "AWS Lambda Proxy" integration request?