Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- server {
- root /path/to/your/stuff;
- index index.html index.htm;
- set $cors "";
- if ($http_origin ~* (.*.yoursweetdomain.com)) {
- set $cors "true";
- }
- server_name yoursweetdomain.com;
- location / {
- if ($cors = "true") {
- add_header 'Access-Control-Allow-Origin' "$http_origin";
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE, PUT';
- add_header 'Access-Control-Allow-Credentials' 'true';
- add_header 'Access-Control-Allow-Headers' 'User-Agent,Keep-Alive,Content-Type';
- }
- if ($request_method = OPTIONS) {
- return 204;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement