netptop / siteproxy

reverse proxy, online proxy, 反向代理,免翻墙访问Youtube/twitter/Google, 支持github和telegram web登录(请注意不要通过不信任的代理进行登录)。支持DuckDuckGo AI Chat(可免费访问chatGPT3.5和Claude3)
MIT License
2.08k stars 1.08k forks source link

Nginx反代后请求出现大量502 #75

Closed wenyifancc closed 8 months ago

wenyifancc commented 8 months ago

Nginx Error Log: upstream sent "Content-Length" and "Transfer-Encoding" headers at the same time while reading response header from upstream

Nginx Version: nginx/1.23.1

使用docker-compose部署模式

netptop commented 8 months ago

可以正常访问google, youtube之类的网站么? 还是特定网站有这个问题?

wenyifancc commented 8 months ago

所有网站都有这个问题,google也是如此,根据nginx日志,可能是nginx验证了上游返回的http响应头中同时出现了Content-Length和Transfer-Encoding image

wenyifancc commented 8 months ago

nginx发现siteproxy返回的response中同时存在了Content-Length和Transfer-Encoding的header,然后就拒绝转发了,目前可用的变通方法是通过caddy中转下,兼容这种特殊header的情况

services:
  site-proxy:
    image: node:18
    container_name: site-proxy
    restart: unless-stopped
    volumes:
      - ./siteproxy/:/home/node/siteproxy/
    working_dir: /home/node/siteproxy/
    entrypoint: ["node","/home/node/siteproxy/bundle.js"]
  caddy:
    image: caddy:latest
    container_name: caddy
    restart: unless-stopped
    ports:
      - 127.0.0.1:5007:5007
    entrypoint: ["caddy","reverse-proxy","-f",":5007","-t","http://site-proxy:5006"]
netptop commented 8 months ago

v2.1.15已经解决。