Random Network Error, Especially on Mobile

(Magnetidog) #1

Hello guys!

One more support question for you. I have a forum setup a bit differently from the default Discourse setup: we have nginx in front of the docker container and connecting through discourse via web sockets. All works perfectly, no problem of any kind, and I can serve discourse from a subdirectory and other pages from other directories on the same site.

Anyhow, we have started receiving, since the latest Discourse update, reports of users getting a Network error message while browsing the forum. The error occurs most of the times only on mobile, but we have had sporadic reports of the same issue on desktop computers.

I tried to debug it in many ways for days, for example increasing Nginx wait timeout, for days, but the reports keep coming in. To make things a nightmare to debug, I do not get the error myself and I do not see any error in the logs (either withing discourse or in the outside’s Nginx installation). What I suspect is some aggressive caching on mobile browsers is causing this, but I cannot reproduce it yet.

The server is also quite powerful, as it is running on 16GB and on 8 cores on Digital Ocean. CPU usage and memory usage well below the acceptable limit.

I wanted to ask if any of you faced this issue recently and how you responded to it.

Thanks all for reading.

(Magnetidog) #2

The cache headers on the json requests seem also to be correct to me, so maybe my hunch about caching problems is wrong.

Cache-Control no-store, must-revalidate, no-cache, private
Connection keep-alive
Content-Encoding gzip
Content-Type application/json; charset=utf-8
Date Fri, 06 Jan 2017 17:26:19 GMT
Server nginx/1.4.6 (Ubuntu)

(Rafael dos Santos Silva) #3

Can you expand a bit on this?

(Magnetidog) #4

Hi Rafael,

I did what is basically described in this thread

and this post in particular helped me as well when I was having some problems:


In brief, you turn off the ports in the app.yml, enable web sockets by adding the - “templates/web.socketed.template.yml” in app.yml (more in that post above), then install an nginx OUTSIDE the docket container which uses the exposed web sockets to connect to Discourse.

At this point, with normal Nginx rules, you can redirect the traffic to wherever you want on your server. Heck, you could even have two Discourse installs in different directories.

(Rafael dos Santos Silva) #5

Those aren’t websockets, but unix sockets. :slight_smile:

Now everything makes sense.

However, I have no clue about your problems. What we usually recommend is removing points of failure and sticking to a simple setup (subdomain instead of subfolder, no outside reverse proxy, etc), but I understand your requirements made you choose this setup.

(Magnetidog) #6

Sorry! :sweat:

Yes, indeed - I insisted about going as simple as possible with the setup to avoid this. We will find a way :wink: