正常使用后,再访问一些网站的502报错问题
Chandler-Lu opened this issue · 1 comments
环境
代码版本:de47a99f4f5386c5c6652ef929412d4b91b3f719
地区:美国(IP 干净)
使用方法:源码部署+ NginX 反代
复现
- 访问 https://example.com/password ,自动跳转到 https://example.com/PASSWORD/https/www.netptop.com
- 从主页访问 Bing,返回 502
但如果开一个隐身窗口,直接访问 https://example.com/PASSWORD/https/www.bing.com ,则 Bing 访问正常,此时退回 ttps://example.com/PASSWORD/ 主页访问 Google 等页面则不正常
NginX 日志:
IP - - [07/Aug/2024:16:55:07 +0800] "GET /PASSWORD/https/www.bing.com HTTP/2.0" 502 552 "https://example.com/PASSWORD/https/www.netptop.com" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36"
另一些问题
正常访问 A 网站后再访问 B 网站(暂时没能稳定复现,不太确定具体是哪些网站),会返回 502,此时再访问别的网站也都会 502。清除 Cookie 后问题解决,怀疑与 proxy_real_host
有关。
例如当我访问完 Bing 再访问 Google 时,后台收到的请求是:
"GET /PASSWORD/https/www.google.com HTTP/2.0" 502 552 "https://example.com/siteproxy_service_worker.js?proxy_real_protocol=https&proxy_real_host=www.bing.com" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36"
NginX 配置:
server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
ssl_certificate ;
ssl_certificate_key ;
server_name example.com;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
location / {
proxy_pass http://127.0.0.1:8002;
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
}
}
我傻了……就是忘了看 error log……
upstream sent too big header while reading response header from upstream
proxy_buffer_size 128k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 128k;