Skip to content

Commit

Permalink
Add CORS to nginx config
Browse files Browse the repository at this point in the history
  • Loading branch information
gofman8 committed Oct 24, 2023
1 parent 8a20882 commit 4e451df
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ server {
location /tx-builder/ {
alias /usr/share/nginx/tx-builder/;
index index.html;
}

}
}
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
}
}

0 comments on commit 4e451df

Please sign in to comment.