|
@@ -1,4 +1,4 @@
|
|
|
-upstream backed_server {
|
|
|
+upstream backend_servers {
|
|
|
server 192.168.6.251:8080 max_fails=1 fail_timeout=10s;
|
|
|
server 192.168.3.251:8080 max_fails=1 fail_timeout=10s;
|
|
|
}
|
|
@@ -26,12 +26,24 @@ server {
|
|
|
|
|
|
location /api {
|
|
|
proxy_read_timeout 300;
|
|
|
- proxy_pass http://backed_server;
|
|
|
+ proxy_pass http://backend_servers;
|
|
|
+
|
|
|
+ # 代理头信息配置
|
|
|
+ proxy_set_header Host $host;
|
|
|
+ proxy_set_header X-Real-IP $remote_addr;
|
|
|
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
+ proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
}
|
|
|
|
|
|
location /ws {
|
|
|
proxy_read_timeout 300;
|
|
|
- proxy_pass http://backed_server;
|
|
|
+ proxy_pass http://backend_servers;
|
|
|
+
|
|
|
+ # 代理头信息配置
|
|
|
+ proxy_set_header Host $host;
|
|
|
+ proxy_set_header X-Real-IP $remote_addr;
|
|
|
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
+ proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
}
|
|
|
|
|
|
# location /api {
|