我正在尝试通过在docker中运行NGINX来启动最简单的反向代理(代理google),这是nginx.conf
events {}
http {
server {
listen 80;
server_name localhost;
location /pricing/ {
proxy_pass https://www.google.com/;
proxy_set_header Host www.google.com;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header User-Agent $http_user_agent;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}
它通常可以工作,但是当涉及到302时,来自google的重定向响应NGINX不考虑暴露在其上的端口号容器,而只是使用80作为带有容器的nginx端口。有办法克服吗?