Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. server {
  2.  
  3. root /path/to/your/stuff;
  4.  
  5. index index.html index.htm;
  6.  
  7. set $cors "";
  8.  
  9. if ($http_origin ~* (.*.yoursweetdomain.com)) {
  10. set $cors "true";
  11. }
  12.  
  13. server_name yoursweetdomain.com;
  14.  
  15. location / {
  16.  
  17. if ($cors = "true") {
  18. add_header 'Access-Control-Allow-Origin' "$http_origin";
  19. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE, PUT';
  20. add_header 'Access-Control-Allow-Credentials' 'true';
  21. add_header 'Access-Control-Allow-Headers' 'User-Agent,Keep-Alive,Content-Type';
  22. }
  23.  
  24.  
  25. if ($request_method = OPTIONS) {
  26. return 204;
  27. }
  28.  
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement