"Connection has been lost" error after update to v1.4.4
-
I'm getting the same issue on 1.4.4. Ho did you solve this?
-
@btw6391 ^^
-
I did not try
xxx.com
instead ofwww.xxx.com
, but it is fixed by./nodebb dev
. However, I dont think it is a good way to fix this problem. This is a serious problem, imagine you have 1000 new threads per day, suddenly your new threads drops to 10 per day.The wired thing is that not all users suffer this problem, but 80% of them do.
-
@sharonyue This bug occurs if the url defined in
config.json
is different from the url which users access your site from.Edit: the reason for this is a security measure.
-
-
@sharonyue yes. Just forward users from
www.example.com
toexample.com
with your reverse proxy. Thewww
subdomain has been long defunct. -
I meet the problem in v.1.4.5
config.json
{
"url": "http://localhost:4567",
..nginx is used for proxy.
How to solve this problem?
-
@joyhope the
url
field inconfig.json
should be set to the URL at which you visit your forum. So if you go tohttps://example.com
to visit your site, then you should havehttp://example.com:4567
as the URL field. -
@PitaJ Hi PitaJ, I am also experiencing this issue. I tried as you suggested and I have tried it by removing the port number at the end of the url. Still it tells me that the connection has been lost.
Is this issue resolved in v1.4.6?
I will try and update it and report back.
-
@teh_g post your config.json and Nginx config, please. Redact any URLs with
example.com
if you must. -
@PitaJ , is an IP address something that can be used as the URL?
My original config.json file used http://localhost:4567, but to test access from external hosts, I tried using the IP address of the nodebb server. As others above have found, this doesn't work because the URLs must match.
How then can I configure the config.json file to use an IP address, temporarily? This is only for internal testing, so I'm not using a webserver or proxy yet.
My goal is to use my nodebb server IP address as the URL value and navigate to that from other hosts.
However, when I try to use the IP address, both the Nodebb server and other hosts receive the connection lost error message.
config.json:
{
"url": "192.168.1.148:4567",
"secret": "NULL",
"database": "mongo",
"mongo": {
"host": "127.0.0.1",
"port": "27017",
"username": "nodebb",
"password": "NULL",
"database": "nodebb"
}
} -
@Alex-Fiala yes you should be able to use IP addresses. However, you still need to have the protocol in there (http://). Copy the address at which you access your NodeBB server and paste it into the config.json
-
Archeology level up, I know, I'm sorry
I get the same problem with the forum configured to be accessible via a subfolder. It is a fresh installation
HTTP is fine (the forum loads fine) but WebSocket is not ("Looks like your connection to NodeBB was lost, please wait while we try to reconnect." message in the bottom right corner)
If I start the forum in development mode, everything runs fine (both HTTP and WS)
Nginx version:
1.10.3
NodeJS version:8.6.0
NodeBB version:1.6.0
nginx configuration
server { listen 80; listen [::]:80; server_name example.com; return 302 https://$server_name$request_uri; } server { listen 443 ssl; listen [::]:443 ssl; server_name example.com; index index.html; root /var/www/html/example; ssl_certificate /etc/letsencrypt/live/example.com/cert.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; location / { try_files $uri $uri/ =404; } location /forum/ { 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 Host $http_host; proxy_pass http://localhost:4567; proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }
config.json
{ "url": "https://example.com/forum/", "secret": -not shown-, "database": "mongo", "mongo": {-not shown-}, "bind_address": "127.0.0.1" }
NodeBB logs
6/10 15:12:55 [5514] - info: Initializing NodeBB v1.6.0 https://example.com/forum/ 6/10 15:12:56 [5514] - info: [socket.io] Restricting access to origin: https://example.com:* 6/10 15:12:57 [5514] - info: Routes added 6/10 15:12:57 [5514] - info: NodeBB Ready 6/10 15:12:57 [5514] - info: Enabling 'trust proxy' 6/10 15:12:57 [5514] - info: NodeBB is now listening on: 127.0.0.1:4567
nginx access log:
my.ip.v4.address - - [06/Oct/2017:15:27:55 +0200] "GET /forum/socket.io/?EIO=3&transport=polling&t=LxntlbI HTTP/1.1" 403 43 "https://example.com/forum/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0"
nginx error.log:
2017/10/06 15:12:55 [error] 4221#4221: *494 connect() failed (111: Connection refused) while connecting to upstream, client: my.ip.v4.address, server: example.com, request: "GET /forum/socket.io/?EIO=3&transport=polling&t=LxnqJud HTTP/1.1", upstream: "http://127.0.0.1:4567/forum/socket.io/?EIO=3&transport=polling&t=LxnqJud", host: "example.com", referrer: "https://example.com/forum/"