0

I've got app up and running on GCP. I can load the app when typing in the external IP so I know the app is OK.

I followed this tutorial where it's nicely demoed how this can be done in a matter of 3 - 4 minutes. I've been wrestling with setting it up for 2 days now.

enter image description here enter image description here

After setting this up I'm getting 404 in the browser. What is strange is that I followed the tutorial to the T and she's got it working and I get 404.

enter image description here

Ideally what I'm trying to do is to redirect both example.com and www.example.com to http://www.example.com

Thank you for any pointers that will lead to resolution.

enter image description here

itsallgood
  • 75
  • 9
  • What is this *app*? Are you using nginx, apache or other server? You usually need to tell that you're listening to that domain too. – Martheen May 08 '21 at 11:12
  • It's a Flask app with Nginx as proxy. It's working fine because I can view it after typing in the external IP of the server and hitting Enter in the address bar. – itsallgood May 08 '21 at 11:14
  • Where does the 404 comes from? Nginx? Flask? – Martheen May 08 '21 at 12:09
  • It's not coming from Nginx nor Flask. I checked logs. I honestly don't know where the error is coming from. Can it be DNS resolution error ? – itsallgood May 08 '21 at 12:16
  • The error is little bit misleading because it says it can't find the root route "/" but when I type in external IP the app loads fine. – itsallgood May 08 '21 at 12:25
  • Does the output of https://dnschecker.org/all-dns-records-of-domain.php for your domain match your settings? – Martheen May 08 '21 at 12:37
  • It found only CNAME record and nothing else ! – itsallgood May 08 '21 at 12:47
  • Did you query for www.yourdomain.com or yourdomain.com? – Martheen May 08 '21 at 12:51
  • When I query `mydomain.com` I get correct values for A (ipv4), NS (nameservers) and SOA record. With `www.mydomain.com` I get only A values. – itsallgood May 08 '21 at 13:01
  • 2
    So the value for A (ipv4) for `mydomain.com` is exactly the same value as the external IP you've tried? By the way I just realized, your CNAME for www shouldn't have the protocol (http://), just the mydomain.com – Martheen May 08 '21 at 13:06
  • I changed it to `mydomain.com` (my real domain) and yes A record is referring to the external IP. – itsallgood May 08 '21 at 14:04
  • Test both mydomain.com and www.mydomain.com on https://web.dev/measure/ – Martheen May 08 '21 at 14:23
  • I've attached results. Funny enough results don't say that the domain throws 404. – itsallgood May 08 '21 at 14:44
  • "Accessibility" shows 91%. Yeah you can access my 404 page all right. :D – itsallgood May 08 '21 at 14:55
  • I think I'm gonna move my app to AWS. It is crazy that something that takes 4 minutes to setup and I struggle to make it work for 2 days with instructions. – itsallgood May 08 '21 at 15:55
  • 1
    From your post in Reddit, you didn't configure your GoDaddy correctly. It's still using its leftover A record to resolve. Remove those. – Martheen May 08 '21 at 22:06

1 Answers1

1

Add your external ip address as A record in the DNS zone records of your domain.

Add www as CNAME record pointing to @

At your app end, setup nginx to respond to yourdomain.com requests.

If these 3 things are done it should work fine.

mdeora
  • 4,152
  • 2
  • 19
  • 29
  • Please take a look at these screenshots: https://www.dropbox.com/s/zhtrm4fa2fl2u3s/imageedit_4_4314984506.png?dl=0 https://www.dropbox.com/s/i88lz4fvyb0s6ep/imageedit_3_6887794384.png?dl=0 https://www.dropbox.com/s/l3e232ghp5rgmy6/imageedit_2_9326495366.png?dl=0 https://www.dropbox.com/s/g5cuxoqi7u6bcnt/imageedit_2_3245803100.png?dl=0 – itsallgood May 08 '21 at 16:42
  • *@itsallgood* as it was mentioned at the comment section, you should cleanup your DNS records and follow instructions from *@mdeora* answer. For example, [here](https://www.dropbox.com/s/i88lz4fvyb0s6ep/imageedit_3_6887794384.png?dl=0) you have lots of `A` and `AAAA` records. – Serhii Rohoza May 10 '21 at 07:05