Advertisement
Guest User

Untitled

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