1

Newbie here, please let me know if I can add any more details or if I'm missing something entirely obvious.

I got my site up and running on an EC2 and I was able to view it with the public DNS.

I pointed my domain to the instance using this guide. I created an elastic IP for the instance, I created four NS records and two A-name record (www, non-www) using route53. I passed these NS records to my domain provider.

The domain appears to have propagated - when I go to the URL, I get redirected to a very old (two restarts ago) public instance DNS address instead of the new one with the elastic IP. I CAN SSH in to the instance using the new domain name but I can't access it from the browser. I checked my security groups, and HTTP/80 is set to allow all traffic.

I tried accessing the EIP directly (redirect), pinging the EIP (time out), accessing the Public DNS directly, pinging the Public DNS, I tried stopping and starting the instance and repeating all previous steps, and I checked that port 80 is open in the security group, but the domain still redirects me to an old public DNS.

Chrome gives me the error ERR_CONNECTION_TIMED_OUT in the browser after I (301) redirected to the old URL.

Not sure where to go from here.

KHobbits
  • 1,138
  • 7
  • 13
Rachel Fee
  • 13
  • 1
  • 3
  • Did you clear the DNS cache on your computer? – 13dimitar Mar 31 '17 at 12:41
  • Yes, also tried a different machine. – Rachel Fee Mar 31 '17 at 12:52
  • Can you send the domain name and the ip address that you want to access? – Leonardo Coelho Mar 31 '17 at 12:49
  • What are the name servers for the domain? If queries for the domain get sent to different name server, you will receive incorrect answer. Check the `whois` database if you're not sure. – 13dimitar Mar 31 '17 at 13:13
  • Question: how long did you wait after the dns change? Don't be surprised if it takes multiple hours for your changes to propagate. Did you try a tool like "dig" to get more insight in your dns changes, and make sure they are correct? I assume hitting the EIP directly with your browser returns the correct site? Also, is the behaviour consistent between the www and non-www url? – Jeroen Jacobs Mar 31 '17 at 13:13
  • @LeonardoCoelho - racheldoesfestivals.com is the domain. – Rachel Fee Mar 31 '17 at 13:42
  • @13nilux - They're amazon name servers. Name Server: NS-1184.AWSDNS-20.ORG Name Server: NS-1691.AWSDNS-19.CO.UK Name Server: NS-502.AWSDNS-62.COM Name Server: NS-592.AWSDNS-10.NET They do match what's listed in Whois. – Rachel Fee Mar 31 '17 at 13:42
  • @JeroenJacobs - It's been about... 14 hours now? I didn't use any tools outside of the guide linked above, fairly new to this. Same behaviour with and without www No, hitting the EIP directly with my browser does NOT work properly, it eventually redirects to the same old public DNS from Amazon. Additionally, I can ping the domain and get the correct EIP back but NO response, it times out. I can SSH into the domain. Which makes me think the EIP is the issue, or something on Amazon's end. – Rachel Fee Mar 31 '17 at 13:42
  • I am at work now, still redirecting to the same outdated public DNS now, but with the error ERR_EMPTY_RESPONSE. All the other behavior is the same. – Rachel Fee Mar 31 '17 at 13:47
  • @KHobbits - Can you help me out with what that means? Something in my settings somewhere? – Rachel Fee Mar 31 '17 at 13:57
  • @RachelFee Because I was limited in space and formatting, I've moved my comment to an answer. – KHobbits Mar 31 '17 at 14:10

1 Answers1

3

Looking into the issue, doing a nslookup on the domain gives me:

Name:   www.racheldoesfestivals.com  
Address: 34.197.64.48

This is an IP belonging to AWS, so I'm assuming this is going to the right place. I would check to see if that matches the EIP, but based on what I'm seeing below, I'm going to assume this is correct.

Using curl against that IP, I get:

[root@server nginx]# curl -v 34.197.64.48
* Connected to 34.197.64.48 (34.197.64.48) port 80 (#0)
> GET / HTTP/1.1
> Host: 34.197.64.48
> User-Agent: curl/7.47.1
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Date: Fri, 31 Mar 2017 14:04:00 GMT
< Server: Apache/2.4.25 (Amazon) PHP/5.6.30
< X-Powered-By: PHP/5.6.30
< X-Pingback: http://ec2-54-211-187-124.compute-1.amazonaws.com/xmlrpc.php
< Location: http://ec2-54-211-187-124.compute-1.amazonaws.com/
< Content-Length: 1
< Content-Type: text/html; charset=UTF-8

This shows to me that I'm indeed hitting a webserver running on 34.197.64.48, but the webserver I'm reaching thinks I should be somewhere else, and is forwarding me to http://ec2-54-211-187-124.compute-1.amazonaws.com/ (This is not Route53 related).

This means that somewhere on the webserver located on 34.197.64.48 there is some code that is triggering a redirect. This could be in your webserver (apache) config file, it could be a .htaccess file, or could be in the application itself.

A lot of websites during the setup phase, make you input a 'primary' website address, which you get redirected to if you visit in any other way. In the past trying to solve this with Wordpress (if this was miss-configured on initial setup) you needed to modify a setting in the database before you can visit the website without being redirected.

I can confirm that we are getting to a working webserver and DNS is working, because running the following command: curl -vH "Host: ec2-54-211-187-124.compute-1.amazonaws.com" 34.197.64.48 Which tricks the webserver into thinking I'm visiting the website returns me html of: RachelDoesFestivals - Guides, musings, media, and other nonsense from a festival obsessionist

If you are patient, you might be able to get into the website using: http://www.racheldoesfestivals.com/wp-login.php
Then fixing the site address in settings->general

KHobbits
  • 1,138
  • 7
  • 13
  • Thank you for the detailed explanation! Yes, you're correct that `34.197.64.48` is the EIP. I did have Wordpress set to the old Public DNS, I've updated that in the db just this morning - if that's it though it's taking some time. I also had a "hello world" test file at the root that wasn't working, but is now. Nothing in .htaccess or apache conf causing a redirect. EDIT - sorry premature edit. – Rachel Fee Mar 31 '17 at 14:42
  • You might want to check that you haven't missed a value in the DB, because I was definitely able to replicate the issue just now. Even visiting the admin panel URL: `http://www.racheldoesfestivals.com/wp-login.php` I can see it's still trying to pull css/js from the old url. One thing to remember is that 301 redirects (what we see visiting the root of the site) are designed to be cached in your browser, so once you've visited it, it will always redirect unless you manage to clear the cache (chrome dev tools doesn't help here). – KHobbits Mar 31 '17 at 14:53
  • Switched over to incogneto and... GOT IT! Yaayyyy, thanks so much! ...And in the end, my server was set up right after all. Of course. *sigh* – Rachel Fee Mar 31 '17 at 14:58