Accessing Octoprint via Public IP


#1

Hello,
I have been trying to set up Octoprint so I can use it from anywhere. I got public IP, but when I type it in it only shows the streaming camera only and not the web interface where you can control the 3D printer. Any suggestions? Many Thanks

Please see the picture.

Using OctoPrint 1.3.6 running on OctoPi 0.14.0


#2

Did you see this post?
https://discourse.octoprint.org/t/i-want-to-access-my-octoprint-installation-from-the-internet-but-i-only-want-people-i-know-to-be-able-to-see-anything/220

What port are you forwarding to the one you are connecting on your public IP?

I'm no expert but maybe you are reaching the streaming service instead of octopi's web server


#3

Yes I saw but didn't help.

Forwarding to port 8080. Yes I am always reaching the streaming service but it is only public IP I have been given by provider...


#4

Don't forward to the streaming service (on port 8080) then. OctoPrint on OctoPi can be reached on port 80. Forward to that.

https://discourse.octoprint.org/t/i-want-to-access-my-octoprint-installation-from-the-internet-how-do-i-do-that/221?u=foosel


#5

Doesn't help. If I forward to any different port I still get only the streaming service instead the web interface.


#7

Can I ask you how to forward the octorprint server to 8080? I just can't figure it out


#8

Might be safer to install pivpn, then use a client to VPN into the octoprint server, and use your LAN IP to view it...this way not only does pivpn only respond to the correct server certificate (that it generates), but the traffic is encrypted from your device to your home internet connection (might need to get a dynamic dns service setup)

Works quite well with my android phone, just connect with openvpn app, then use printoid (or whatever printer monitor software you want to use) to view the status of your printer


#9

@NgA -- it sounds like you're changing the external port you're forwarding from as opposed to the interval port you're forwarding to. It doesn't matter what external port you're forwarding from and point your browser at, if you're forwarding to 8080 internally, you're going to see the streaming service. However you setup your port forward to 8080, just change the internal port to 80 instead. It doesn't matter what the external port is so long as you put the same one into your browser/app on the external side, you'll see the OctoPrint web UI.

For example, if you already have a web server running on your gateway or you're already forwarding port 80 from your gateway to a web server internally for other purposes, you can still forward 8080 from your gateway to 80 on your OctoPi and then pointing a browser at your public IP :8080 should still give you the OctoPrint web UI.

Disclaimer: @WarHawk is right -- you're better off setting up a VPN and having some security in place. Putting OctoPrint (or anything really) directly accessible to the Internet is a bad idea unless you really really know what you're doing.

Even Bigger Disclaimer: Be wary of printing when you or someone you can contact easily is not physically near the printer. 3D Printers do occasionally catch fire in the real world. Someone needs to be there to deal with that in the unlikely event it happens. Ask me how I know.


#10

This is an example of the forward on my router, it is forwarding port 81 to my pi's port 80

So an example if my home ip was 123.125.123.11 so to access my pi I would put http://123.125.123.11:81

Then in my haproxy config the frontend public starts like this,

frontend public
        bind *:80

This is how I setup my haproxy so I only need one port forward on my router

global
        maxconn 4096
        user haproxy
        group haproxy
        tune.ssl.default-dh-param 1024
        log 127.0.0.1 local1 debug

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        retries 3
        option redispatch
        option http-server-close
        option forwardfor
        maxconn 2000
        timeout connect 5s
        timeout client  15min
        timeout server  15min

frontend public
        bind *:80
        option forwardfor except 127.0.0.1
        use_backend webcam if { path_beg /webcam/ }
        use_backend octoprint
        default_backend octoprint
        errorfile 503 /etc/haproxy/errors/503-no-octoprint.http

backend octoprint
        reqrep ^([^\ :]*)\ /(.*) \1\ /\2
        reqadd X-Scheme:\ https if { ssl_fc }
        option forwardfor
        server octoprint1 127.0.0.1:5000

backend webcam
        reqrep ^([^\ :]*)\ /webcam/(.*)     \1\ /\2
        server webcam1  127.0.0.1:8080

So,
To get Octoprint, http://123.125.123.11:81
To get the webcam, http://123.125.123.11:81/webcam/
To get the webcam stream, http://123.125.123.11:81/webcam/?action=stream


#11

@Zoombee why the added webcamstream endpoint? That seems to be the only difference from the stock haproxy.cfg that ships in OctoPi that I see here.p


#12

@foosel you are correct, I was doing some troubleshooting of an iOS app and didn't remove it when done.
Fixed my post.