我正在使用两个系统(都是 Nginx 负载均衡器,一个充当备份)。
我想添加和使用一些 HTTP 自定义标头。
以下是我的代码;
upstream upstream0 {
#list of upstream servers
server backend:80;
server backup_load_balancer:777 backup;
#healthcheck
}
server {
listen 80;
#Add custom header about the port and protocol (http or https)
server_name _;
location / {
# is included since links are not allowed in the post
proxy_pass "http://upstream0;"
}
}
备份系统
server {
listen 777;
server_name _;
#doing some other extra stuff
#use port and protocol to direct
}
我怎样才能做到这一点?