Troubleshooting WebSocket Connections
Polymer uses WebSockets to receive data updates from OctoPrint. Some web proxy configurations break this connection. Solutions for common proxy problems are shown below:
Ngrok Tunnel
- Click the wrench icon () in the top-right corner to open OctoPrint settings
- Navigate to the ‘API’ section, under the ‘Features’ heading
- Enable the ‘Allow Cross Origin Resource Sharing (CORS)’ option
- Restart OctoPrint
Nginx
See this guide from the OctoPrint community forum on how to correctly configure Nginx. In particular, ensure that your Nginx configuration contains the following options:
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
HAProxy
SSL
(Thanks Georg for debugging this issue!)
If you are connecting over SSL to HAProxy, your configuration in the backend octoprint
section should look like this:
backend octoprint
reqrep ^([^\ :]*)\ /(.*) \1\ /\2
reqadd X-Scheme:\ https if { ssl_fc }
option forwardfor
server octoprint1 127.0.0.1:5000
errorfile 503 /etc/haproxy/errors/503-no-octoprint.http
See this example configuration from this guide