Nginx 转发导致死循环
考虑以下 nginx 配置:
|
|
假设 api.kpromise.top 和 wiki.kpromise.top 解析到同一个 ip,那么请求:wiki.kpromise.top/api/xx 时,虽然反代到了 api.kpromise.top,但由于又设置了 proxy_set_header Host $http_host;
这里 http_host 指的是:wiki.kpromise.top,那么请求又会继续转发,从而进入死锁。想要解决该问题也简单,将 proxy_set_header Host $http_host;
改为:proxy_set_header Host api.kpromise.top;
最后更新于