Site's not loading properly in Chromium
-
So after upgrading to 0.4.0, I'm dealing with a situation where my site works just fine in FF, but fails to load properly in Chromium browser.
From Chromium Web console, I get messages like:
'ws://forum.linuxbsdos.com/socket.io/1/websocket/91qNRaWZ3rYcF-mt333a' failed: Unexpected response code: 502 http://forum.linuxbsdos.com/ Failed to load resource: the server responded with a status of 504 (Gateway Time-out) http://forum.linuxbsdos.com/socket.io/1/xhr-polling/91qNRaWZ3rYcF-mt333a?t=1396434040701 Failed to load resource: the server responded with a status of 504 (Gateway Time-out)
And in Nginx error log file, I see:
When the site does not load.
*3345 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 127.0.0.1, server: forum.linuxbsdos.com, request: "GET /socket.io/1/xhr-polling/_wPAI1JGYSBw2sCntjYj?t=1396431796572 HTTP/1.1", upstream: "http://127.0.0.1:4567/socket.io/1/xhr-polling/_wPAI1JGYSBw2sCntjYj?t=1396431796572", host: "forum.linuxbsdos.com", referrer: "http://forum.linuxbsdos.com/topic/62/wayland-in-gnome-3"
And when the home page loads, but the sidebar does not
2089 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: forum.linuxbsdos.com, request: "GET /socket.io/1/websocket/91qNRaWZ3rYcF-mt333a HTTP/1.1", upstream: "http://127.0.0.1:4567/socket.io/1/websocket/91qNRaWZ3rYcF-mt333a", host: "forum.linuxbsdos.com"
I've tried adding these lines to my Nginx config for the subdomain, but that didn't help.
proxy_buffers 8 32k; proxy_buffer_size 64k; large_client_header_buffers 8 32k;
I have no clue why the site works in FF, but not in Chromium. Anu clues?
-
I'm getting this issue on both FF and Chrome on your forum:
Chrome:
WebSocket connection to 'ws://forum.linuxbsdos.com/socket.io/1/websocket/ct5r19aj6ajqTEkwHw4T' failed: Error during WebSocket handshake: Unexpected response code: 502
FF:
Firefox can't establish a connection to the server at ws://forum.linuxbsdos.com/socket.io/1/websocket/HrBkWg4DsJYpa-EHHw4Q.
I would imagine that something's going on with your websockets and nginx... is it still trying to connect to port 4567?
-
Well, I'm sure something's going on between WebSockets and Nginx but I just don't know what. I'm not too concerned about FF because it works. The issue with FF is very minor. the home page sidebar takes a few extra seconds to load after the main content area loads.
Chromium is the real headache. I've looked the config over. Added a few options and tweaked others, but still not working on Chromium. On Android and Chromium (desktop), I have to refresh a page before it even loads. And even at that, the sidebar does not load.
I'm tempted to think that Varnish might have a role to play in this. I have Varnish (port 80) in front of Nginx (8080). Does Varnish play nice with WebSockets?
-
Solved this problem, at least on the desktop.
The problem is that Varnish has to be specially configured for WebSockets. So the site now loads smoothly on FF and Chromium, with no errors in the Web console. However, it still does not load properly on Android (Chrome). If anybody reading this has an iPad, please let me know whether forum.linuxbsdos.com loads properly.
I'll post a tutorial on how to do it later tomorrow on my forum and post the link here.
-
I solved the socket problem too , following the guide linked in my previous post. Varnish need some attention to work with sockets.
@julian could you add this in nodebb wiki? the following are the settings that you need to add to your
/etc/varnish/default.vcl
to make varnish work with nodejs/nodebbbackend nodebb { .host = "127.0.0.1"; # your app host .port = "4567"; # your app port } sub vcl_recv { # Pipe websocket connections directly to Node.js if (req.http.Upgrade ~ "(?i)websocket") { set req.backend = nodebb; return (pipe); } # NodeBB if (req.http.host == "forum.yourwebsite.com") { # change this if (req.url ~ "^/socket.io/") { set req.backend = nodebb; return (pipe); # return pass seems not working for websockets } return (pass); # don't cache } } sub vcl_pipe { # Need to copy the upgrade header if (req.http.upgrade) { set bereq.http.upgrade = req.http.upgrade; } }
Now i have only 1 problem to solve and make v0.4.0 work:
TypeError: template.match is not a function templates.js:101
-
@manuel -- For that error, you'll have to disable your widgets, as one or more of them seem to not be playing nicely.
In Redis:
keys widg* # Should show four keys del {those four keys, each separated by a space}
Or alternatively, in shell:
$ redis-cli keys widg* | xargs redis-cli DEL
Of course, back up your database first