Monday, April 11, 2022

[SOLVED] RaspberryPi access without public URL possible?

Issue

[Never worked with a RPi before, absolute noob on that field]

I want to make a desktop/mobile app to access a program on a RaspberryPi. The only task of the app is to send a command and display the received response on an UI. It's meant only for private use, but it should also work outside my local network. So as long as I have mobile internet on the phone it should be possible to access the program with the app. Can I achieve this without using any kind of public website? I saw some tutorials that used Flask and other frameworks to do sth similar, but I want the access to be restricted to the app. There shouldn't be any URL I could type in my browser, that gives me access to a login page or sth like that. If you know the specific term for what I am describing here or even better an article/tutorial that features it, that would be very helpful.


Solution

You need two things for that:

  • Make your Raspi visible to the outside world. That can typically be done by configuring port forwarding in your router. Note that this might impose a certain security risk.

  • Make sure you have a global DNS name for your internet access. Since the IP of your router may change frequently (depending on your ISP), you need a URL or rather, a DNS entry. There exist public DNS services that can assign a DNS entry to a dynamic IP (typically for a fee). Many routers support a protocol to configure such services.

After that, you can program an app that uses the given DNS entry to talk to your Pi.

So no, without a public URL, this is not possible, at least not over the long term. You might be able to go with the public IP of your router, but then your app may fail from one day to the next.



Answered By - PMF
Answer Checked By - Robin (WPSolving Admin)