Configuring a web proxy for OctoPrint under OctoPi

:memo: Note

This guide assumes that you are running OctoPi 0.16.0 or later.

If your local network requires you to use a proxy server to connect to sites on the internet, you'll have to do some manual configuration in OctoPi in order to make that work.

First of all SSH into your Pi (username pi, default password raspberry but you really should have changed that...) and follow this guide to tell your Linux system to use the proxy.

That's not all though, next you'll need to tell systemd to also run OctoPrint in a way that it'll know about your proxy server. Run sudo nano /etc/systemd/system/octoprint.service (the file doesn't exist yet, you are going to create it). You are now editing the file. Make it look like this (with the correct proxy settings for your site of course):

[Unit]
Description=The snappy web interface for your 3D printer
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=pi
Environment=http_proxy=http://127.0.0.1:3128
Environment=https_proxy=http://127.0.0.1:3128
Environment=no_proxy=localhost,127.0.0.1
ExecStart=/home/pi/oprint/bin/octoprint --host 127.0.0.1 --port 5000

[Install]
WantedBy=multi-user.target

Save, exit the editor. Register for startup:

sudo systemctl enable octoprint.service

Then reload the unit: sudo systemctl daemon-reload. And finally restart OctoPrint: sudo service octoprint restart. It should now be using the proxy for all connections.

However, the connectivity check will still fail since it requires an actual direct connection. Simply disable it by unchecking Settings > Server > Connectivity check > Enable regular connectivity check:

1 Like

Hello, why is this tutorial only for Octopi 0.16. Do you think it is also possible for 0.15 ? And if not. Could you maybe explain why ?

Would be nice =)

I got it running on Octopi 0.15.1 however on every restart I will get:

The OctoPrint server is currently not running

I have to restart with: sudo service octoprint restart then it is working ... donΒ΄t know why :confused: so the startup routine is broken somehow I guess

got it running with a workaround. with a script and rc.local . The script triggers octoprint restart on startup.

Hi, after following these instructions on OctoPi 0.17.0, OctoPrint wont autostart at boot, and I have to enter sudo service octoprint start each time. The ExecStart path seems fine, so do you have any idea on why this is happening? Could it be something else that prevents OctoPrint from starting up?

EDIT: Found it! You need to run this command after creating and saving that octoprint.service file: systemctl enable octoprint.service. Should be added to this guide!

Hi, how can i configure a user and a passwort for the proxy?
got no succes with "http://[user]:[pass]@[proxy]:[port]/"