跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[程序员] nginx 反代 websocket,为什么被代理端写入错误 write: broken pipe ?

发表于

客户端能与 nginx 握手成功,但接收不到数据,难道是 nginx 这边关闭了被代理端连接? 搞了快一天,Google 也搜不到,使劲浑身解数还是没辙,

upstream target {
        server xxx.xxx.xxx.xxx:8080;
}
 location /wss {
        proxy_pass http://target/ws;
        proxy_http_version 1.1;
        proxy_set_header Upgrade websocket;
        proxy_set_header Connection "Upgrade";
        proxy_redirect off;
        proxy_cache_bypass $http_upgrade;
    	proxy_set_header Host $host;
    	proxy_set_header X-Real-IP $remote_addr;
    	proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    	proxy_buffering off;
    	proxy_set_header X-Forwarded-Host $server_name;
        proxy_set_header Access-Control-Allow-Origin *;
        proxy_set_header X-NginX-Proxy true;
        proxy_set_header Upgrade $http_upgrade;
	    proxy_set_header Connection $connection_upgrade;
	    gzip off;
	    proxy_set_header X-Forwarded-Ssl on;
	    proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Frame-Options SAMEORIGIN;
        proxy_read_timeout 5d;
        proxy_send_timeout 5d;
        proxy_connect_timeout 5d;
        send_timeout 5ds;
        fastcgi_connect_timeout 5d;  
        fastcgi_read_timeout 5d;   
        fastcgi_send_timeout 5d;   
    }

然后 golang 这边服务端写入时的错误为

ws written err: write tcp xxx:8080->xxx:53376: write: broken pipe

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.