I had some hang up with the webcam, but I think I was able to get that working with a full URL setting in octoprint.
The only remaining issue is the page is taking VERY long to initially load.
The cam feed doesnt show up and I can not click the login button for 45-60 seconds after I try to reach the page. Anyone have any ideas why it is taking so long to load and how I can speed it up.
I currently have both on an internal network segment so networking speed is not the issue. Im at a bit of a loss.
As am I. Normally I'd say either network latencies or it's a first time load, but if it stays slow on repeated reloads something else is off. If possible, try loading without the reverse proxy in between, to rule that out as the problem.
This is just a guess again, but it sounds like the initial page initialization might be taking up quite some time, causing the JS not to bind (and hence the login button to not be "armed"). When you disable the webcam, do you get the same issue? Just to rule out that it's the webcam stream through nginx somehow blocking any kind of needed request for full page initialization...
Hm, nope, the problem is higher up. Or at least I'd expect it to be higher up. The first thing that happens on socket initialization is a request to sockjs/info (IIRC), then a websocket will be attempted to be opened, then if that fails it's a fallback to various long polling approaches. Here I see an open websocket and a failed attempt to use the eventsource backend.
Hi,
I have another probem I have two printer with octoprint.
Now I would like to have nginx as reverse proxy with basic authentification.
This works fine with the first instance, with /printer1 and /webcam. And here is the trouble. I can setup /printer2 to show the second octoprint, but I can't add a second location for the webcam on the second octoprint.
Is there a way to change the /webcam stream to another location?
I'm using Nginx in a docker container with built in letsencrypt support and SSL, but the principle should be the same. Here's what I've got to serve up Octoprint on a subfolder of my main domain and with a webcam (Logitech C920) working fine.
My Raspberry Pi has a static IP on 192.168.0.240.
I can reach Octoprint on https://server.com/octoprint & the webcam on https://server.com/octocam
This reverse proxy configuration works "out the box" with no edits required to /boot/octoprint.txt
Once you've confirmed that the above two are working you can configure Octoprint in the webui with a webcam stream URL of https://server.com/octocam/?action=stream and a snapshot URL of https://server.com/octocam/?action=snapshot
Obviously the IP of 192.168.0.240 and server.com will be replaced by whatever you are using in your setup.
Any chance you can share your subdomain config info? I'm using letsencrypt in a docker image on an R710 server and trying to figure out the proper subdomain config file
I Copy pasted that into a file "octoprint.subfolder.conf" in the config files for my LinuxServer/LetsEncrypt container, and it worked perfectly.
I was previously working fine using subdomains, but I needed to change my certificate so I restructured LetsEncrypt.
Here was the working config I had for a LetsEncrypt Subdomain: @jagr200
# make sure that your dns has a cname set for deluge and that your deluge container is not using a base url
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name octoprint.*;
include /config/nginx/ssl.conf;
client_max_body_size 0;
# enable for ldap auth, fill in ldap details in ldap.conf
#include /config/nginx/ldap.conf;
location / {
# enable the next two lines for http auth
#auth_basic "Restricted";
#auth_basic_user_file /config/nginx/.htpasswd;
# enable the next two lines for ldap auth
#auth_request /auth;
#error_page 401 =200 /login;
# DO NOT INCLUDE THE DEFAULT - OVERRIDES BELOW
#include /config/nginx/proxy.conf;
#Settings per this link: https://community.octoprint.org/t/reverse-proxy-configuration-examples/1107
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
proxy_http_version 1.1;
client_max_body_size 0;
#Settings from the proxy.conf that need to be imported since import was disabled
client_body_buffer_size 128k;
#Timeout if the real server is dead
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
# Advanced Proxy Config
send_timeout 5m;
proxy_read_timeout 240;
proxy_send_timeout 240;
proxy_connect_timeout 240;
# TLS 1.3 early data
proxy_set_header Early-Data $ssl_early_data;
# Basic Proxy Config
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Ssl on;
proxy_redirect http:// $scheme://;
proxy_cache_bypass $cookie_session;
proxy_no_cache $cookie_session;
proxy_buffers 32 4k;
proxy_headers_hash_bucket_size 128;
proxy_headers_hash_max_size 1024;
#Required in this file
resolver 127.0.0.11 valid=30s;
set $upstream_octoprint 192.168.1.105;
proxy_pass http://$upstream_octoprint;
}
}
Here is a basic Caddy Server v2 configuration, assuming you are running Caddy on the same machine as the OctoPrint. It is easy to adapt if your OctoPrint installation is on another machine. The example is in the "Caddyfile" style.
In my specific case, I have a subdomain assigned to the OctoPrint installation, which is running on another machine from Caddy Server. My configuration is thus:
Because I have not specified http at the beginning of subdomain.example.com, the default is assumed to be https, and it will automatically generate a Let's Encrypt certificate and attach it by default.