都是使用的 Nginx Proxy Manager ,原网站一切正常,用了 SSL ,反代 HTTPS 。
最后在 websockets 这里卡住了,websocket support 打开了,所有的同步加载的东西全都无法连接,哪吒面板“实时同步通断断开”,lobehub 接收完了之后再一起回复,而不是一个字一个字的往外蹦。
问 chatgpt4 说我配置正常的,GOOGLE 也查不到解决方案,麻烦大佬帮我看下配置是不是有问题。
#PROXY-START/
client_max_body_size 100M;
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 Sec-WebSocket-Extensions $http_sec_websocket_extensions;
proxy_set_header Sec-WebSocket-Key $http_sec_websocket_key;
proxy_set_header Sec-WebSocket-Version $http_sec_websocket_version;
proxy_cache off;
proxy_redirect off;
proxy_buffering off;
location / {
proxy_ssl_server_name on;
proxy_ssl_name example.com;
proxy_ssl_protocols TLSv1.2 TLSv1.3;
proxy_pass https://example.com/;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host example.com;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location ~* \.(gif|png|jpg|css|js|woff|woff2)$
{
proxy_ssl_server_name on;
proxy_ssl_name example.com;
proxy_ssl_protocols TLSv1.2 TLSv1.3;
proxy_pass https://example.com;
proxy_set_header Host example.com;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
expires 1h;#图片缓存浏览器过期时间
}
location /ws {
proxy_pass http://example.com;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header Origin $scheme://$host;
proxy_cache_bypass $http_upgrade;
}
#PROXY-END/
proxy_set_header, Upgrade, tlsv, host