Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Viewing Cloud Compute Engine Application in Web Browser

I have a Dash application that I can run locally and view in my browser. I have moved it to Google Cloud Compute Engine and the app runs, but I can't see it in my browser at the 127.0.0.1 address where it's running. I have tried to allow http and https traffic to the virtual machine using gcloud compute firewall-rules create FIREWALL_RULE --allow tcp:80,tcp:443 in the console without any luck. How can I view it in my browser?

like image 225
sh4399 Avatar asked Nov 27 '25 11:11

sh4399


1 Answers

You were able to reach http://127.0.0.1 and/or https://127.0.0.1 when you run it locally because you run your web browser on the same computer. More information you can find here:

The local loopback mechanism may be used to run a network service on a host without requiring a physical network interface, or without making the service accessible from the networks the computer may be connected to. For example, a locally installed website may be accessed from a Web browser by the URL http://localhost to display its home page.

The name localhost normally resolves to the IPv4 loopback address 127.0.0.1, and to the IPv6 loopback address ::1.

As result, you can access IP 127.0.0.1 located on your VM instance only from your VM instance.

To check your application on IP 127.0.0.1 you can use command curl from command line of your VM instance:

instance:~$ curl -I http://127.0.0.1
instance:~$ curl -I https://127.0.0.1

To allow access to your application via ports 80/443 you should go to Compute Engine -> VM instances -> click on NAME_OF_YOUR_VM_INSTANCE-> click on EDIT -> go to Firewalls and select Allow HTTP traffic and Allow HTTP traffic -> click Save. Have a look at the documentation Firewall rules overview and Configuring network tags to find more details.

To access your application from web browser you should use external IP address that you can find at Compute Engine -> VM instances -> look for NAME_OF_YOUR_VM_INSTANCE and External IP:

http://EXTENAL_IP_OF_YOUR_VM_INSTANCE
https://EXTENAL_IP_OF_YOUR_VM_INSTANCE
like image 145
Serhii Rohoza Avatar answered Nov 29 '25 21:11

Serhii Rohoza



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!