Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 3.68 KB | None | 0 0
  1. events {
  2.     worker_connections  1024;
  3. }
  4.  
  5.  
  6. http {
  7.     include       /etc/nginx/mime.types;
  8.     default_type  application/octet-stream;
  9.  
  10.     server {
  11.         listen 8000;
  12.         location / {
  13.             if ($request_method = 'OPTIONS') {
  14.                 add_header 'Access-Control-Allow-Credentials' true;
  15.                 add_header 'Access-Control-Allow-Origin' $http_origin;
  16.                 add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
  17.                 add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
  18.                 add_header 'Access-Control-Max-Age' 1728000;
  19.                 add_header 'Content-Type' 'text/plain; charset=utf-8';
  20.                 add_header 'Content-Length' 0;
  21.                 return 204;
  22.             }
  23.             proxy_pass       http://127.0.0.1:3000;
  24.             proxy_set_header X-Forwarded-For $remote_addr;
  25.         }
  26.  
  27.         location /api {
  28.             if ($request_method = 'OPTIONS') {
  29.                 add_header 'Access-Control-Allow-Credentials' true;
  30.                 add_header 'Access-Control-Allow-Origin' $http_origin;
  31.                 add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS, PUT, PATCH';
  32.                 add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Cookie';
  33.                 add_header 'Access-Control-Expose-Headers' 'Content-Length,Set-Cookie,Content-Range';
  34.                 add_header 'Access-Control-Max-Age' 1728000;
  35.                 add_header 'Content-Type' 'text/plain; charset=utf-8';
  36.                 add_header 'Content-Length' 0;
  37.                 return 204;
  38.             }
  39.             proxy_pass       http://127.0.0.1:5463;
  40.             proxy_set_header X-Forwarded-For $remote_addr;
  41.         }
  42.  
  43.         location ~ /api/(v[0-9]+)/ {
  44.             if ($request_method = 'OPTIONS') {
  45.                 add_header 'Access-Control-Allow-Credentials' true;
  46.                 add_header 'Access-Control-Allow-Origin' $http_origin;
  47.                 add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS, PUT';
  48.                 add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Cookie';
  49.                 add_header 'Access-Control-Expose-Headers' 'Content-Length,Set-Cookie,Content-Range';
  50.                 add_header 'Access-Control-Max-Age' 1728000;
  51.                 add_header 'Content-Type' 'text/plain; charset=utf-8';
  52.                 add_header 'Content-Length' 0;
  53.                 return 204;
  54.             }
  55.  
  56.             proxy_pass       http://127.0.0.1:8088;
  57.             proxy_set_header X-Forwarded-For $remote_addr;
  58.         }
  59.  
  60.         location ~ /api/file/ {
  61.             client_max_body_size 0;
  62.             if ($request_method = 'GET') {
  63.                 add_header 'Content-Type' 'data:application/octet-stream';
  64.             }
  65.             proxy_pass       http://127.0.0.1:8088;
  66.             proxy_set_header X-Forwarded-For $remote_addr;
  67.         }
  68.  
  69.         location /files/ {
  70.             root /usr/share/nginx/app/static;
  71.             gzip on;
  72.         }
  73.         add_header 'Access-Control-Allow-Origin' $http_origin always;
  74.         add_header 'Access-Control-Allow-Credentials' true always;
  75.         add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, OPTIONS' always;
  76.         add_header 'Access-Control-Allow-Headers' 'DNT,Cookie,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
  77.         add_header 'Access-Control-Expose-Headers' 'Content-Length,Set-Cookie,Content-Range' always;
  78.     }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement