Advertisement
Guest User

Untitled

a guest
Feb 13th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. #
  2. # Wide-open CORS config for nginx
  3. #
  4. location / {
  5. if ($request_method = 'OPTIONS') {
  6. add_header 'Access-Control-Allow-Origin' '*';
  7. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  8. #
  9. # Custom headers and headers various browsers *should* be OK with but aren't
  10. #
  11. add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
  12. #
  13. # Tell client that this pre-flight info is valid for 20 days
  14. #
  15. add_header 'Access-Control-Max-Age' 1728000;
  16. add_header 'Content-Type' 'text/plain; charset=utf-8';
  17. add_header 'Content-Length' 0;
  18. return 204;
  19. }
  20. if ($request_method = 'POST') {
  21. add_header 'Access-Control-Allow-Origin' '*';
  22. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  23. add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
  24. add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
  25. }
  26. if ($request_method = 'GET') {
  27. add_header 'Access-Control-Allow-Origin' '*';
  28. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  29. add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
  30. add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement