Skip to content

Commit 85e4ecc

Browse files
committed
Added CORS for ALB requests
1 parent 2c7c091 commit 85e4ecc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎handler.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ def handler(event, context):
110110
"statusDescription": str(error.args[1]) + " Server Error",
111111
"headers": {
112112
"Content-Type": "text/html",
113+
"Access-Control-Allow-Origin": "*",
114+
"Access-Control-Allow-Headers": "Content-Type,X-Amz-Date,Authorization,X-Api-Key,x-requested-with",
115+
"Access-Control-Allow-Methods": "POST,GET,OPTIONS",
113116
},
114117
"body": error.args[0],
115118
}
@@ -136,6 +139,9 @@ def handler(event, context):
136139
"statusDescription": "200 OK",
137140
"headers": {
138141
"Content-Type": "application/json",
142+
"Access-Control-Allow-Origin": "*",
143+
"Access-Control-Allow-Headers": "Content-Type,X-Amz-Date,Authorization,X-Api-Key,x-requested-with",
144+
"Access-Control-Allow-Methods": "POST,GET,OPTIONS",
139145
},
140146
"body": json.dumps(validation_result(config))
141147
}
@@ -156,6 +162,8 @@ def handler(event, context):
156162
"headers": {
157163
"Location": link,
158164
"Access-Control-Allow-Origin": "*",
165+
"Access-Control-Allow-Headers": "Content-Type,X-Amz-Date,Authorization,X-Api-Key,x-requested-with",
166+
"Access-Control-Allow-Methods": "POST,GET,OPTIONS",
159167
},
160168
"statusCode": 302,
161169
"statusDescription": "302 Found",

0 commit comments

Comments
 (0)