Skip to content

Commit

Permalink
Attempt to add CORS to shared apigateway
Browse files Browse the repository at this point in the history
  • Loading branch information
D42H5 committed Dec 13, 2024
1 parent d54b222 commit aaa608a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion cdk/api_gateway/shared_api_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,22 @@ def __init__(self, scope: Construct, stage: str,
def create_rest_api(self):

# Create the Rest API
self.api = aws_apigateway.RestApi(self, 'SharedApiGateway')
self.api = aws_apigateway.RestApi(
self,
'SharedApiGateway',
default_cors_preflight_options=aws_apigateway.CorsOptions(
allow_origins=aws_apigateway.Cors.ALL_ORIGINS, # Allow all origins
allow_methods=aws_apigateway.Cors.ALL_METHODS, # Allow all HTTP methods
allow_headers=[
"Content-Type",
"Authorization",
"X-Amz-Date",
"X-Api-Key",
"Accept",
"Origin",
],
),
)

# Handle dns integration
if self.create_dns:
Expand Down

0 comments on commit aaa608a

Please sign in to comment.