|
| 1 | +upstream frsadmin { |
| 2 | + server compreface-admin:8080 fail_timeout=10s max_fails=5; |
| 3 | +} |
| 4 | + |
| 5 | +upstream frsapi { |
| 6 | + server compreface-api:8080 fail_timeout=10s max_fails=5; |
| 7 | +} |
| 8 | + |
| 9 | +upstream frscore { |
| 10 | + server compreface-core:3000 fail_timeout=10s max_fails=5; |
| 11 | +} |
| 12 | + |
| 13 | +server { |
| 14 | + listen 80; |
| 15 | + server_name ui; |
| 16 | + return 301 https://$host$request_uri; |
| 17 | +} |
| 18 | + |
| 19 | +server { |
| 20 | + listen 443 ssl; |
| 21 | + server_name ui; |
| 22 | + ssl_certificate /etc/nginx/ssl/fullchain.pem; |
| 23 | + ssl_certificate_key /etc/nginx/ssl/privkey.pem; |
| 24 | + |
| 25 | + client_max_body_size 10M; |
| 26 | + |
| 27 | + location / { |
| 28 | + root /usr/share/nginx/html/; |
| 29 | + index index.html; |
| 30 | + try_files $uri $uri/ /index.html =404; |
| 31 | + } |
| 32 | + |
| 33 | + location /admin/ { |
| 34 | + proxy_pass http://frsadmin/admin/; |
| 35 | + } |
| 36 | + |
| 37 | + location /api/v1/ { |
| 38 | + |
| 39 | + proxy_read_timeout 60000ms; |
| 40 | + proxy_connect_timeout 10000ms; |
| 41 | + |
| 42 | + if ($request_method = 'OPTIONS') { |
| 43 | + add_header 'Access-Control-Allow-Origin' '*'; |
| 44 | + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE'; |
| 45 | + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,x-api-key'; |
| 46 | + add_header 'Access-Control-Max-Age' 1728000; |
| 47 | + add_header 'Content-Type' 'text/plain; charset=UTF-8'; |
| 48 | + add_header 'Content-Length' 0; |
| 49 | + return 204; |
| 50 | + } |
| 51 | + add_header 'Access-Control-Allow-Origin' '*' always; |
| 52 | + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always; |
| 53 | + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,x-api-key' always; |
| 54 | + |
| 55 | + proxy_pass http://frsapi/api/v1/; |
| 56 | + } |
| 57 | + |
| 58 | + location /core/ { |
| 59 | + if ($request_method = 'OPTIONS') { |
| 60 | + add_header 'Access-Control-Allow-Origin' '*'; |
| 61 | + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE'; |
| 62 | + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,x-api-key'; |
| 63 | + add_header 'Access-Control-Max-Age' 1728000; |
| 64 | + add_header 'Content-Type' 'text/plain charset=UTF-8'; |
| 65 | + add_header 'Content-Length' 0; |
| 66 | + return 204; |
| 67 | + } |
| 68 | + |
| 69 | + add_header 'Access-Control-Allow-Origin' '*' always; |
| 70 | + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always; |
| 71 | + add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,x-api-key' always; |
| 72 | + |
| 73 | + proxy_pass http://frscore/; |
| 74 | + } |
| 75 | + |
| 76 | + location ~ ^/(api|admin)/(swagger-ui.html|webjars|swagger-resources|v2/api-docs)(.*) { |
| 77 | + proxy_set_header 'Host' $http_host; |
| 78 | + proxy_pass http://frs$1/$2$3$is_args$args; |
| 79 | + } |
| 80 | +} |
0 commit comments