forked from agent-network-protocol/anp-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx_config.conf
More file actions
34 lines (26 loc) · 1.13 KB
/
nginx_config.conf
File metadata and controls
34 lines (26 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 所有anp-examples相关的路由
location /anp-examples/ {
# 应用限流规则,如果需要的话
limit_req zone=wba_limit burst=50 nodelay;
# 重要:移除前缀,使用rewrite指令
rewrite ^/anp-examples/(.*) /$1 break;
# 代理到本地web_app服务
proxy_pass http://localhost:5000/;
# 基础代理设置
proxy_set_header Host $host;
# 客户端 IP 相关设置
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;
# 设置真实客户端 IP 头部
proxy_set_header True-Client-IP $remote_addr;
# 保留所有头部信息
proxy_set_header Authorization $http_authorization;
# 添加代理信息头部
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
# 设置超时时间
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
}