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;
}
}
@ivesko7
Copy link

ivesko7 commented May 7, 2022

thanks, I used this to get my reverse proxy working with octopi!

@randy3k
Copy link
Author

randy3k commented May 7, 2022

thanks, I used this to get my reverse proxy working with octopi!

I’m glad that it helps.

@argael
Copy link

argael commented Nov 19, 2022

Hey,

Seems to be the config I'm searching for a while. But how do you enter it in the NginX Proxy Manager GUI? I don't found a config file or so... Can you explain ?
Regards

@randy3k
Copy link
Author

randy3k commented Nov 19, 2022

You could copy and paste these in the advanced setting.

@argael
Copy link

argael commented Nov 20, 2022

Oh, yeah.
I've tried (and seems working in Nginx Proxy Man.) but have the same problem with the connexion: WebSocket connection to 'wss://my.domain.tld/sockjs/938/qfpsx55q/websocket' failed
and nothing special in the octoprint.log. I'm still searching...

Thanks.

@aw-jansen
Copy link

@argael did you ever get this working with npm?

@H3adsho0ot
Copy link

If someone is looking for this error - enable CORS in octopi under Settings -> API

@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