User Tools

Site Tools


reverse_proxy_multiple_octoprint_instances_with_nginx

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
reverse_proxy_multiple_octoprint_instances_with_nginx [2025/11/30 21:07] tkbletscreverse_proxy_multiple_octoprint_instances_with_nginx [2025/11/30 21:14] (current) tkbletsc
Line 17: Line 17:
             rewrite ^ https://$host$uri permanent;             rewrite ^ https://$host$uri permanent;
         }         }
 +        # require login
         auth_basic           "OctoPrint: PrintrBot";         auth_basic           "OctoPrint: PrintrBot";
         auth_basic_user_file /etc/nginx/passwd-3dprinter.conf;         auth_basic_user_file /etc/nginx/passwd-3dprinter.conf;
 +        
 +        # proxy
         rewrite ^/printrbot/(.*)$ /$1 break;         rewrite ^/printrbot/(.*)$ /$1 break;
         proxy_pass http://192.168.0.42;         proxy_pass http://192.168.0.42;
Line 33: Line 36:
  
         location /printrbot/webcam/ {         location /printrbot/webcam/ {
-            auth_basic off;+            auth_basic off; # no login for just the webcam
             rewrite ^/printrbot/webcam/(.*)$ /webcam/$1 break;             rewrite ^/printrbot/webcam/(.*)$ /webcam/$1 break;
             proxy_pass http://192.168.0.42;             proxy_pass http://192.168.0.42;
Line 49: Line 52:
             rewrite ^ https://$host$uri permanent;             rewrite ^ https://$host$uri permanent;
         }         }
 +        # require login
         auth_basic           "OctoPrint: Prusa";         auth_basic           "OctoPrint: Prusa";
         auth_basic_user_file /etc/nginx/passwd-3dprinter.conf;         auth_basic_user_file /etc/nginx/passwd-3dprinter.conf;
 +        
 +        # proxy
         rewrite ^/prusa/(.*)$ /$1 break;         rewrite ^/prusa/(.*)$ /$1 break;
         proxy_pass http://192.168.0.46;         proxy_pass http://192.168.0.46;
Line 65: Line 71:
  
         location /prusa/webcam/ {         location /prusa/webcam/ {
-            auth_basic off;+            auth_basic off; # no login for just the webcam
             rewrite ^/prusa/webcam/(.*)$ /webcam2/$1 break;             rewrite ^/prusa/webcam/(.*)$ /webcam2/$1 break;
             proxy_pass http://192.168.0.46;             proxy_pass http://192.168.0.46;
Line 78: Line 84:
 Things to note: Things to note:
  
-  * Octoprint (as configured in an Octopi install) expects the webcam to be at /webcam – an absolute URL. +  * Webcam stuff: 
-  * Thus, the first "location ~ ^/webcam/(.*)" to rewrite it under the new URL. +    * Octoprint (as configured in an Octopi install) expects the webcam to be at /webcam – an absolute URL. 
-  * Because //all//  Octoprint instances expect their webcam to be at /webcam, we need to tweak things a bit. +    * Thus, the first "location ~ ^/webcam/(.*)" to rewrite it under the new URL. 
-  * The second Octoprint will map /webcam2 instead of just /webcam; we'll change the config on that instance as well to allow this +    * Because //all//  Octoprint instances expect their webcam to be at /webcam, we need to tweak things a bit. 
-  * (Note: if you have just once octoprint instance, then you can skip the following steps, and you should be done)+    * The second Octoprint will map /webcam2 instead of just /webcam; we'll change the config on that instance as well to allow this 
 +    * (Note: if you have just once octoprint instance, then you can skip the following steps, and you should be done) 
 +  * Auth stuff: 
 +    * The above config requires HTTP auth for the main interface, but explicitly allows the webcam without auth. 
 +    * This way you can stream the webcams from a plain page to anyone, but login requires auth. 
 +    * You can omit "auth_basic off" to require auth for both. 
 +    * You can omit all the "auth_basic" entirely to disable auth for both. 
  
 ===== Enabling webcam support for Octoprint instances after the first ===== ===== Enabling webcam support for Octoprint instances after the first =====
reverse_proxy_multiple_octoprint_instances_with_nginx.1764565652.txt.gz · Last modified: by tkbletsc

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki