Difference between revisions of "HTTP redirect using lambda handler"

From wikieduonline
Jump to navigation Jump to search
 
Line 1: Line 1:
 
 
 
<pre>
 
<pre>
 
  def lambda_handler(event, context):
 
  def lambda_handler(event, context):
Line 19: Line 17:
 
     return response
 
     return response
 
</pre>
 
</pre>
 +
 +
== Related ==
 +
* [[CloudFront Lambda@Edge]]
  
 
== See also ==
 
== See also ==

Latest revision as of 10:40, 21 June 2023

 def lambda_handler(event, context):
 
     # Generate HTTP redirect response with 302 status code and Location header.
     
     response = {
         'status': '302',
         'statusDescription': 'Found',
         'headers': {
             'location': [{
                 'key': 'Location',
                 'value': 'http://docs.aws.amazon.com/lambda/latest/dg/lambda-edge.html'
             }]
         }
     }
     
     return response

Related[edit]

See also[edit]

Advertising: