Advertisement
Guest User

Untitled

a guest
Sep 18th, 2018
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 1.87 KB | None | 0 0
  1. location / {
  2.  
  3.     if ($request_method = 'OPTIONS') {
  4.        add_header 'Access-Control-Allow-Origin'      '*' always;
  5.        add_header 'Access-Control-Allow-Methods'     'GET, POST, OPTIONS, PUT, PATCH' always;
  6.        add_header 'Access-Control-Allow-Headers'     'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,Pragma,Origin,X-Context,app-id' always;
  7.        add_header 'Access-Control-Expose-Headers'    'Content-Length,Content-Range,Access-Control-Allow-Origin,Access-Control-Allow-Methods,Access-Control-Allow-Headers,Access-Control-Allow-Credentials' always;
  8.        add_header 'Access-Control-Allow-Credentials' 'true' always;
  9.        #
  10.        # Tell client that this pre-flight info is valid for 20 days
  11.        #
  12.        add_header 'Access-Control-Max-Age' 1728000 always;
  13.        add_header 'Content-Type' 'text/plain; charset=utf-8' always;
  14.        add_header 'Content-Length' 0 always;
  15.        return 204;
  16.     }
  17.  
  18.     add_header 'Access-Control-Allow-Origin'      '*' always;
  19.     add_header 'Access-Control-Allow-Methods'     'GET, POST, OPTIONS, PUT, PATCH' always;
  20.     add_header 'Access-Control-Allow-Headers'     'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization, Pragma, Origin, X-Context, app-id' always;
  21.     add_header 'Access-Control-Expose-Headers'    'Content-Length,Content-Range,Access-Control-Allow-Origin,Access-Control-Allow-Methods,Access-Control-Allow-Headers,Access-Control-Allow-Credentials' always;
  22.     add_header 'Access-Control-Allow-Credentials' 'true' always;
  23.  
  24.     proxy_set_header   Host              $http_host;
  25.     proxy_set_header   X-Real-IP         $remote_addr;
  26.     proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
  27.     proxy_redirect     off;
  28.  
  29.     include         uwsgi_params;
  30.     uwsgi_pass      unix:/var/www/uwsgi/project.sock;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement