Skip to content

Commit

Permalink
Added CORS for ALB requests
Browse files Browse the repository at this point in the history
  • Loading branch information
antonbabenko committed Mar 7, 2020
1 parent 2c7c091 commit 85e4ecc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ def handler(event, context):
"statusDescription": str(error.args[1]) + " Server Error",
"headers": {
"Content-Type": "text/html",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "Content-Type,X-Amz-Date,Authorization,X-Api-Key,x-requested-with",
"Access-Control-Allow-Methods": "POST,GET,OPTIONS",
},
"body": error.args[0],
}
Expand All @@ -136,6 +139,9 @@ def handler(event, context):
"statusDescription": "200 OK",
"headers": {
"Content-Type": "application/json",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "Content-Type,X-Amz-Date,Authorization,X-Api-Key,x-requested-with",
"Access-Control-Allow-Methods": "POST,GET,OPTIONS",
},
"body": json.dumps(validation_result(config))
}
Expand All @@ -156,6 +162,8 @@ def handler(event, context):
"headers": {
"Location": link,
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "Content-Type,X-Amz-Date,Authorization,X-Api-Key,x-requested-with",
"Access-Control-Allow-Methods": "POST,GET,OPTIONS",
},
"statusCode": 302,
"statusDescription": "302 Found",
Expand Down

0 comments on commit 85e4ecc

Please sign in to comment.