Issues with wss behind nginx


What is the problem?
I've had my OctoPrint server running successfully for months now behind an nginx reverse proxy to provide SSL. Just the other day, it started failing. I get the following errors in Firefox:

(Apparently I am only allowed to post one image in my post so all images will be Imgur links)

And in Chrome:

The page loads the basics but doesn't show the red color at the top and is unresponsive to any clicking. Then it will show "Server is offline". Eventually it will load fully, showing my file list and the red color at the top but I get lots of errors in the console. Eventually it then goes back to "Server is offline".

What did you already try to solve it?
I've investigated a lot.

Plugin issue? Tried safe mode but the error persists.

Connection issue? Tried running over WiFi or over ethernet (what I normally use) but the same issue.

SSL issue? All my certs come up okay for my domain and the subdomain the printer is using.

Maybe something went wrong with my install of OctoPrint? Tried burning a different SD card, same issue.

Maybe logs will show me something? The OctoPrint logs don't give me any errors. Nginx shows a 499 for certain things:

499 appears to be that the client cut the connection, hence why I decided to see if it was a slow connection issue.

Does it work without nginx? Yes! Loading directly from the IP or hostname in both FF and Chrome will load the page perfectly, even over HTTPS (once ignoring the warning page). So it must be something with nginx!

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, octoprint.log, serial.log or output on terminal tab, ...)

OctoPrint is version: 1.3.8
OctoPi is version: 0.15.0

All plugins and such are up to date according to the Software Update menu.

My nginx config for OctoPrint:

Other information: OctoPrint is running on a Pi 3 B running over ethernet to the main network. Externally, it is behind nginx (a separate server), accessible via a subdomain.

Edit: Link to printer:

I'll be happy to provide any other info needed!



So I haven't touched anything since my first post. Somehow accessing the site through nginx is working a lot better. It's actually responsive and loads. I am not getting the "Printer is offline" issue anymore. But in the console, I still get some "Firefox can’t establish a connection to the server at wss://" errors. Not as many but some still.