fdbdf6e5 by lihua

修改nginx代理

1 parent 88053911
1 server { 1 server {
2 listen 80; 2 listen 9000;
3 listen [::]:80; 3 listen [::]:9000;
4 server_name localhost; 4 server_name localhost;
5 # server_name http://192.168.6.20:8052;
6 client_max_body_size 100M; 5 client_max_body_size 100M;
7 6
8 # 设置允许跨域的域名,可以使用通配符 '*' 允许所有域访问 7 # 设置允许跨域的域名,可以使用通配符 '*' 允许所有域访问
...@@ -28,57 +27,13 @@ server { ...@@ -28,57 +27,13 @@ server {
28 expires -1s; 27 expires -1s;
29 } 28 }
30 29
31 location /api { 30 location /api/ {
32 # 设置允许跨域的域名,可以使用通配符 '*' 允许所有域访问 31 resolver 169.254.25.10 valid=30s;
33 add_header 'Access-Control-Allow-Origin' * always; 32 proxy_pass http://ms-daop-trust-data-space-gateway-server-temp.tds:8052/;
34 # 设置允许的 HTTP 方法 33 proxy_set_header Host $host;
35 add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE, PUT'; 34 proxy_set_header X-Real-IP $remote_addr;
36 # 设置允许的请求头 35 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
37 add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, Accept, Origin, X-Requested-With'; 36 proxy_set_header X-Forwarded-Proto $scheme;
38 # 如果需要支持 cookie,可以设置以下 header
39 add_header 'Access-Control-Allow-Credentials' 'true';
40 # 缓存设置
41 add_header Cache-Control no-cache;
42 add_header Cache-Control private;
43
44 # 使用 rewrite 将 /api 替换为 /new-api
45 rewrite ^/api/(.*)$ /$1 break;
46 proxy_pass http://192.168.6.20:58052;
47 }
48
49 location /circulation {
50 # 设置允许跨域的域名,可以使用通配符 '*' 允许所有域访问
51 add_header 'Access-Control-Allow-Origin' * always;
52 # 设置允许的 HTTP 方法
53 add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE, PUT';
54 # 设置允许的请求头
55 add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, Accept, Origin, X-Requested-With';
56 # 如果需要支持 cookie,可以设置以下 header
57 add_header 'Access-Control-Allow-Credentials' 'true';
58 # 缓存设置
59 add_header Cache-Control no-cache;
60 add_header Cache-Control private;
61
62 # 使用 rewrite 将 /circulation 替换为 /new-api
63 rewrite ^/circulation/(.*)$ /$1 break;
64 proxy_pass http://192.168.6.20:18052;
65 }
66 location /delivery {
67 # 设置允许跨域的域名,可以使用通配符 '*' 允许所有域访问
68 add_header 'Access-Control-Allow-Origin' * always;
69 # 设置允许的 HTTP 方法
70 add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE, PUT';
71 # 设置允许的请求头
72 add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, Accept, Origin, X-Requested-With';
73 # 如果需要支持 cookie,可以设置以下 header
74 add_header 'Access-Control-Allow-Credentials' 'true';
75 # 缓存设置
76 add_header Cache-Control no-cache;
77 add_header Cache-Control private;
78
79 # 使用 rewrite 将 /circulation 替换为 /new-api
80 rewrite ^/delivery/(.*)$ /$1 break;
81 proxy_pass http://192.168.6.20:38052;
82 } 37 }
83 38
84 error_page 500 502 503 504 /50x.html; 39 error_page 500 502 503 504 /50x.html;
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!