1

I've been playing around with various web configurations in Debian for about a year now. I've set up DNS for a fow domains in the process and have never really had an issue. I:

  • Go to Google domains and point the DNS at my ip
  • Go to digital ocean and do the same thing
  • Set up Server Name and Server Alias in my sites-available config file

Then I'm off to the races.

However this time around after doing those things, my site will resolve if I use the domain name, but the URL changes to show the IP address once the page has loaded.

I don't even know how this could happen or what information someone would need to know what's causing it. What could be going wrong?

  • Have you confirmed it's a 3xx redirect? If "the URL changes to show the IP address once the page has loaded" then that suggests something in the application logic is triggering the redirect (eg. hostname not configured in the CMS or something?!). However, what do you mean exactly by "Go to Google domains and point the DNS at my ip"? And you wouldn't expect to "do the same thing" at "Digital Ocean"? – MrWhite Aug 22 '17 at 21:19
  • Did you create the site in your web server? While this may seem like a silly question, you will be surprised by how often people fail to do this. – closetnoc Aug 22 '17 at 23:44
  • I don't think I did. I have a virtual host set up in my sites-available. I'm not home so I can't reference any specifics. I'm basically using a cgi backend to run a small blog – Turk Aug 23 '17 at 0:03
  • @MrWhite, I mean that google domains has a portal for assigning IP addresses to given domains, as well as DO having an option to add Domains to a given droplet. I've always set those two up and they've worked every time without fail which is why I'm confused as to why I am getting this problem now – Turk Aug 23 '17 at 13:59
1

... but the URL changes to show the IP address once the page has loaded.

This is only possible via post javascript processing of the page. Somewhere in the javascript code, there is a line instructing the web browser to replace the contents of the address bar with the IP address.

The only other possibility is that your web browser may contain a virus or it might have been created poorly.

If however you worded your question wrong and you're trying to say "the URL in the address bar changes to the IP address before the page has finished loading" then you have an HTTP response from accessing the URL itself that indicates a redirect to the IP address.

Go to redbot.org and put in http:// followed by your domain name (no spaces) and press enter to see results.

If the first line of the response starts with any of the following:

HTTP/1.1 301
HTTP/1.1 302
HTTP/1.0 301
HTTP/1.0 302

Then its redirecting to another URL which is listed next to the line beginning with:

Location:

That URL is likely the IP address you're complaining about.

If you want to investigate more, you can visit webpagetest.org and put in your domain there and in the results, access the waterfall section (where you see how long each request takes) and if you see yellow bars, then that means at least one redirect to another URL happened.

  • I followed what you said regarding redbot, and it turns out you're correct in your assumption that the first output is HTTP/1.1 302 Found I went into my sites-available and noticed I don't actually have a location parameter set anywhere in my configs. I am still new to dev ops wizardry so pardon my lack of understanding.Is this something that I need to have set? – Turk Aug 23 '17 at 13:56
  • It ended up being an issue with how I had it set up in google domains. I had my A and CNAME set incorrectly which now that they are, everything works seamlessly. If it was for your suggestions I never would have realized though so thank you! – Turk Aug 23 '17 at 16:20
  • When you have a 302 or 301 status, there always needs to be a location header or else browsers will be confused. – Mike Aug 24 '17 at 3:06
  • I never would of known that haha, I appreciate the help though, learning system management like this on my own is far more difficult than I anticipated – Turk Aug 24 '17 at 3:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.