Reputation: 4640
Is there a way that I can make a GET
request from an external server (like google apps script
) to my local server?
For example, I would like to make a GET
request on this url: http://localhost:3000/api/get_data
If I do that then I get DNS error
. Replacing localhost
with my ip address gives Bad Request
Upvotes: 1
Views: 3056
Reputation: 16182
The "localhost" address is not accessible from the Internet, so you can't use it. Having your IP instead of "localhost" may work, that depends on the firewall rules of your ISP and on your local machine.
The easy way to expose your local machine to internet is either by using SSH (if you have the remote machine that is accessible from Internet, for example, Amazon EC2 instance). You can use -R
ssh switch for that, something like this ssh -R *:8181:localhost:3000 remote-machine
and you can use "http://remote-machine:8181" to connect to your app.
See also The Black Magic Of SSH / SSH Can Do That?.
Another way is to use service like https://ngrok.com/ that will do the remote part for you.
Upvotes: 2