Skip to content

Instantly share code, notes, and snippets.

@randy3k
Last active June 9, 2024 12:02
Show Gist options
  • Save randy3k/8a263cff68031e60e00fb75fce963006 to your computer and use it in GitHub Desktop.
Save randy3k/8a263cff68031e60e00fb75fce963006 to your computer and use it in GitHub Desktop.
octopi/octoprint config for nginx proxy manager
location ~ ^/webcam/(.*) {
rewrite ^/webcam/(.*) /octopi/webcam/$1 redirect;
}
location /octopi/ {
if ($scheme != "https") {
rewrite ^ https://$host$uri permanent;
}
rewrite ^/octopi/(.*)$ /$1 break;
proxy_pass http://192.168.0.167;
proxy_redirect ~^http://192.168.0.167/(.*)$ $scheme://$host/octopi/$1;
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_set_header X-Script-Name /octopi;
proxy_http_version 1.1;
client_max_body_size 0;
location /octopi/webcam/ {
rewrite ^/octopi/webcam/(.*)$ /webcam/$1 break;
proxy_pass http://192.168.0.167;
proxy_redirect ~^http://192.168.0.167/(.*)$ $scheme://$host/octopi/$1;
auth_basic "Authorization required";
auth_basic_user_file /data/access/1;
}
}
@sebyldino
Copy link

sebyldino commented Jun 9, 2024

Works well. Thanks!
(Need to remove webcam section for me)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment