我用dockers新建了两个一样的实例,想用nginx来做反向代{过}{滤}理,但是开启nginx就一直报302的错误,前端发过来的请求,nginx给每个实例都分发了,导致实例之间相互相应造成重定向。这个问题困扰我很久了,希望有大佬指点一下。万分感谢。nginx配置如下
[Shell] 纯文本查看 复制代码 pstream odoo {
# server 10.13.166.108:8069;
server 127.0.0.1:8889 weight=100 max_fails=2 fail_timeout=15;
server 127.0.0.1:8888 weight=100 max_fails=2 fail_timeout=15;
}
#upstream odoochat {
# server 10.13.166.108:8072;
# server 127.0.0.1:8888;
# server 127.0.0.1:8889;
# server 127.0.0.1:8888;
#}
server {
listen 8081;
# web/login;
# server_name 10.13.166.108;
# Add Headers for odoo proxy mode
# proxy_set_header X-Forwarded-Host $host:8081;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto $scheme;
# proxy_set_header X-Real-IP $remote_addr;
# Add Headers for odoo proxy mode
proxy_set_header X-Forwarded-Host $host:8081;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
# log
access_log /var/log/nginx/odoo.access.log;
error_log /var/log/nginx/odoo.error.log;
# cache static data
location ~* /web/static/ {
proxy_cache_valid 200 60m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo;
}
# Redirect longpoll requests to odoo longpolling port
# location /longpolling {
# proxy_pass http://odoochat;
# proxy_set_header Host $host:8081;
# proxy_redirect off;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# }
# Redirect requests to odoo backend server
location / {
proxy_redirect off;
proxy_pass http://odoo;
# proxy_set_header Host $host:8081;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# common gzip
gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
gzip on;
}
报错如下:
报错
|