I want to access my OctoPrint installation from the internet, how do I do that?

First of all: Don't even think about doing that without enabling Access Control! I can't stress enough how important it is to secure your printer when you want to make it accessible from the internet (or any public/untrusted network for that matter). So please, before doing that, make sure you have Access Control configured and functioning.

If the only reason for wishing to put OctoPrint on the internet is that you just want to be able to access it remotely yourself, consider rather using a cloud access plugin like PolarCloud or a messenger plugin like Telegram. Alternatively look into setting up a VPN or at the very least HTTP Authentication. See also this topic on restricting access further as well as this blog post on various ways to achieve safe remote access to your OctoPrint instance.

Still want to do this? Then you should be aware that putting your OctoPrint instance online like this means that literally anyone can connect to it and see what you are printing. Don't think that just because you haven't told anyone your IP or host name that your instance won't get found. You can bet on every single public IP on the internet seeing a crawler within hours of it going online that will probe what is running on it and log that information in some search engine. Keep that in mind.

Now with all that being out of the way, if you really want to make your OctoPrint instance publicly available over the internet you'll need to create a port forwarding on your router to the system (i.e. your Raspberry Pi) and the port you are running OctoPrint on. With a vanilla OctoPrint install that means you'll need to forward to port 5000. If you configured HAProxy to make OctoPrint accessible on port 80 (which you really should if you want to get the webcam stream to work too, OctoPi also ships like this) then you'll need to forward to port 80.

You'll also want to make sure you'll be able to reach your router/home network without having to know your current IP address. For this you'll want to use a Dynamic DNS service like http://www.noip.com/ or http://www.dnsdynamic.org. Those are services that will give you a named address like "yourName.no-ip.org". You'll need to get your router to update the address every time your IP changes (look for a "Dynamic DNS" setting in the router settings). If your router can't do it, you can also install ddclient on your RPi.

Another way of doing this is to use a service such as ngrok or Pagekite. See each service's docs for specific instructions on tunneling ports.

4 Likes