Skip to content

Commit

Permalink
Merge pull request #138 from maticnetwork/DEVOPS-2599-cors-issue-update
Browse files Browse the repository at this point in the history
Devops 2599 cors issue update
  • Loading branch information
sshrihar authored Apr 9, 2024
2 parents 007bbc8 + f1c8853 commit a13b49f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
deploy_workflow:
name: Deploy static
name: Deploy static ${{ inputs.environment }}
permissions:
id-token: write
contents: write
Expand Down
11 changes: 7 additions & 4 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ server {
location / {
try_files $uri $uri/ /index.html =404;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS"; # Update to include OPTIONS method
add_header Access-Control-Allow-Headers "Authorization, Content-Type"; # Specify allowed headers
add_header Access-Control-Max-Age 86400; # Set CORS preflight request cache duration
add_header Access-Control-Allow-Credentials false;
add_header Access-Control-Allow-Headers *;
add_header Access-Control-Allow-Methods GET;
add_header Access-Control-Allow-Methods POST;
add_header Access-Control-Allow-Methods OPTIONS;
add_header Access-Control-Expose-Headers *;

if ($request_method = 'OPTIONS') {
return 204; # Return 204 No Content for OPTIONS requests
}
}
}

0 comments on commit a13b49f

Please sign in to comment.