'Raspberry Pi - Access remote IP address from external website / python app

I have an app running on my Raspberry Pi 3b+ on an internal IP address of http://192.168.1.8/app/ http://192.168.1.8:8080/app/

I would like to be able to access this from a remotely hosted python script on Heroku.

Currently I have the script running locally on my laptop, but only works when Im on the same internal network. I would like to have the python script running remotely so I can be away from the Pi and it still runs.

I ran all the usual whatsmyIP.com tools, and have the remote IP, but its the external IP of my router, not the Pi.

Does anyone have any suggestions of how I could make this work?

Thanking you in advance of any advice you can provide.

All the best, Simon



Solution 1:[1]

You should look at Port Forwarding. Which port you forward depends on the settings of your RPi and your application. Enabling port forwarding is different for all routers, but you can normally access the routersettings by navigating to 192.168.0.1 or 192.168.0.0 on your computer. Doing so allows a connection directly from your Pi to the outworld internet.

You should also take into account that your public IP is prone to change. That's because Internet Providers typically use dynamic IP addresses rather than static IP addresses. Some do provide them when specifically asking for one, often you have to pay a small monthly fee. You should therefore include a script where your raspberry pi updates you about any public IP changes, or use a DDNS service provider.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 lcdumort