Advertisement
Guest User

Untitled

a guest
May 26th, 2014
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. location /admin/remotecontrol/ {
  2.  
  3. if ($http_origin ~* (https?://.*\.mlza\.sggw\.pl(:[0-9]+)?)) {
  4. set $cors "true";
  5. }
  6.  
  7.  
  8. if ($request_method = 'OPTIONS') {
  9. set $cors "${cors}options";
  10. }
  11. if ($request_method = 'GET') {
  12. set $cors "${cors}get";
  13. }
  14. if ($request_method = 'POST') {
  15. set $cors "${cors}post";
  16. }
  17.  
  18. if ($cors = "true") {
  19. add_header 'Access-Control-Allow-Origin' "$http_origin";
  20. }
  21.  
  22. if ($cors = "trueget") {
  23. add_header 'Access-Control-Allow-Origin' "$http_origin";
  24. add_header 'Access-Control-Allow-Credentials' 'true';
  25. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  26. add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
  27. }
  28.  
  29. if ($cors = "trueoptions") {
  30. add_header 'Access-Control-Allow-Origin' "$http_origin";
  31.  
  32. add_header 'Access-Control-Allow-Credentials' 'true';
  33. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  34.  
  35. add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
  36.  
  37. add_header 'Access-Control-Max-Age' 1728000;
  38. add_header 'Content-Type' 'text/plain charset=UTF-8';
  39. add_header 'Content-Length' 0;
  40. return 204;
  41. }
  42.  
  43. if ($cors = "truepost") {
  44. add_header 'Access-Control-Allow-Origin' "$http_origin";
  45. add_header 'Access-Control-Allow-Credentials' 'true';
  46. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
  47. add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
  48.  
  49. }
  50. try_files $uri $uri/ /index.php?q=$uri&$args;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement