'Can't connect to GCP VM website with external IP

Trying to connect to my django website (from the browser) that's stored on the GCP virtual machine. Everything works fine if I'm accessing it internally using internal IP or localhost.

However, I can't access website with external IP. No logs in django that would say someone trying to access if I'm trying with external IP.

I have http, https traffic enabled on instance.

Firewall rule to allow port 80:

enter image description here

Here is Test-Net results.

enter image description here

Searched the web for answers but nothing looks wrong in my settings.. Any ideas would be appreciated.

UPDATE:

  1. Do not create or change egress rules unless you know exactly what they do. They are not necessary for ingress rules (VPC Firewalls automatically allow return traffic):

I've changed all firewall rules back how they were so now only port 80 is allowed.

  1. You have an ingress rule for the target http-server. Is that target flag set on the VM instance?

enter image description here

  1. What is the output from sudo lsof -i -P -n | grep LISTEN? Your Django server must be listening on 0.0.0.0.0 instead of localhost.

I have 0.0.0.0 with port 80 at django terminal. enter image description here I use windows 2016 server so don't know the powershell function that would display what you asked for. Here is netstat listening ports for django.

enter image description here



Sources

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

Source: Stack Overflow

Solution Source