Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

有没有哪位使用nginx反向代理,老是提示“连接发生错误:异常中断 聊天异常中断了!可能是网络问题。” #84

Open
h00cker opened this issue May 31, 2023 · 4 comments

Comments

@h00cker
Copy link

h00cker commented May 31, 2023

我使用ip加端口地址直接访问的话,没有问题。
但是使用nginx反向代理通过域名访问,可以连接上,但是一问问题就提示“连接发生错误:异常中断 聊天异常中断了!可能是网络问题。


哪位老大有使用nginx的,帮忙提供下nginx的配置,谢谢!

@fireflyrqh
Copy link

是的,错误,呜呜呜,无法宝塔

@jianjianai
Copy link
Owner

这种情况可能是websocket没有被正确反向代理,http成功,websocket失败。

@h00cker
Copy link
Author

h00cker commented Jun 1, 2023

这种情况可能是websocket没有被正确反向代理,http成功,websocket失败。

非常感谢,通过将websocket也反向代理,解决了问题。

如下配置供大家参考:

map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
}
server {
    listen       443 ssl;
    server_name   yourdomain.com;

    ssl_certificate      cert.pem;
    ssl_certificate_key  cert.key;

    ssl_session_cache    shared:SSL:1m;
    ssl_session_timeout  5m;

    ssl_ciphers  HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers  on;

        location / {
        proxy_pass http://127.0.0.1:8088;

    client_max_body_size 100M;
    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_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";

	}

}

@JK-zy
Copy link

JK-zy commented Jun 6, 2023

老哥能不能详细点,没弄过不太懂啊

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants