Ngrok Tunnel: A more secure but simple to use alternative to port forwarding

Thanks for that information @fieldOfView. It seems that has to be manually set, even in default octopi instance, because the default setting within OctoPrint based on this is that it will use the port OctoPrint was started on, which by default is 5000.

Not with OctoPi; I am fairly sure that gets preset to port 80 here:

Though that does leave the question how it was set to port 5000 on your setup. Did you perhaps at some point remove your config.yaml to have it recreated from scratch by OctoPrint?

I think I can at least make a check for this configuration, or at least have the portnumber configurable.

I wasn't using octopi, I was using default raspbian and added octoprint so I think I just didn't configure it correctly. I went ahead and deleted the old partition and used the octopi image working fine now. Thanks for all the help guys

Yeah, there's no telling on this pi, it's running an older nightly build of octopi 0.18 and there is a good chance during testing something I deleted that config.yaml.

Hey fieldOfView, thanks for the awesome work.

I have downloaded the plugin recently and it is working fine.
but I believe that the basic authentication is not working for me, when I'm accessing the ngrok link there is no username and password are popping up from the browser, it will open directly the login page of octoprint.
is this behavior is right? or did I miss configure the plugin?

Hi @nori0aw, sorry I missed this comment. The tunnel should ask for a username and password. However, once you have entered that, your browser may remember the username and password (or actually the "session") until you restart the browser. Could you try closing all browser windows and opening the tunnel again? Could you try a different browser and/or your browser incognito mode?

Continuing the discussion from Ngrok Tunnel: A more secure but simple to use alternative to port forwarding:

Hi @fieldOfView, thank you for your reply,
I have tried to restart both the Octopi system & the browser with incognito at the same time and still no luck. I also will tried to uninstall and reinstall the plugin with the same result.
I think it's an issue with Ngrok in my region.

That should be easy to check; what is your region?

I am in UAE so I choose the option region option "Asia/Pacific" in the plugin.
how can I check It?

You can check it by changing to another region. But I don't think that will change much.

I think this may be caused by a newer version of the ngrok python binding used by the plugin. I'll look in to that.

1 Like

I think I have fixed the issue. Are you running OctoPrint on Python 3 (if so, good for you!)? And did you install the ngrok plugin after the 25th of October?

I am new to octopi, I have set it up just recently (2 month ago), not sure how to check for the python version on octopi but I'm running version 1.4.2.
for the ngrok plugin i have tried to re-install it 10 days ago.

I have tried today the new update that you published (0.3.1) also I face the same issue.

Check the bottom left corner of the web interface, it should say there.

Thank you Charlie,

it is 2.7.16
image

1 Like

Would love if you could add a qr code for the tunnel url so I can scan it quickly with the phone when I need to step out. Save me from typing it.

This actually seemed like a good idea, so I took a stab at it. Will submit a PR to see if @fieldOfView wants to implement or not. Just need to clean up the code for when the tunnel gets closed.

image

1 Like

You are too fast with this stuff man!
Thanks for the PR.

PR submitted, if anyone would like to try it out you can install by copying/pasting the URL below in Plugin Manager > Get More > ...from URL and clicking install.

https://github.com/jneilliii/OctoPrint-ngrok/archive/refs/heads/feature/qrcode.zip

That looks great! Exactly as I imagined

Can you tell it to generate the url as https:// instead of http://?

1 Like