先上代理配置:
server { listen 9090; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { #proxy_pass https://qyapi.weixin.qq.com; proxy_pass https://qyapi.weixin.qq.com; # proxy_pass https://webchat-worning; proxy_set_header Host $proxy_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; index index.html index.htm; } }
当你请求代理地址出现403响应时,检查proxy_set_header Host设置是否是$proxy_host,或者去掉这行配置,重启nginx后即可正常访问了。
转载请注明:Terry's blog » 解决nginx反向代理403问题