A record to a sever Ip not working

0

Good day I use a conventional Host service for my WordPress website, say example.com. I also have deployed a flask web application on a server, say its IP is 1.1.1.1.

I want to create an "A Record" on my domain , say app.example.com, which points to the web application on 1.1.1.1. I have created an "A Record" using cPanel and also i have make a PTR record for server. when i check the PTR and A record nothing is wrong: FCrDNS test result: 1.1.1.1 resolved to app.example.com; app.example.com resolved to 1.1.1.1.;

... but it does not work (after 24 h). when you enter app.example.com it shows "Apache2 Ubuntu Default Page" not the application and also when you enter 1.1.1.1. it shows the application correctly but in the address bar still shows the IP not the address. Thank you in advance for helping

Dr Simon

Posted 2019-04-22T06:48:24.947

Reputation: 1

Answers

1

No, it sounds like the DNS record works fine: it resolves to your server's IP address. That's all the DNS record does in the first place. The rest is not done by DNS.

What pages are served at http://app.example.com depends entirely on your webserver's configuration – it must recognize that domain name, that is, Apache configuration must have a corresponding "VirtualHost" block with ServerName app.example.com to match the received URL.

Finally, what is shown in the browser's address bar does not depend on DNS, and especially not on reverse DNS (really you don't even need rDNS). If you visit http://app.example.com, the web browser shows http://app.example.com, exactly what you visited.

So if you see the web browser showing http://1.1.1.1 for some reason, and you definitely did not type that address, the only other possibility is that the webserver redirected you there. That is, it received the original request for http://app.example.com and responded with an HTTP 30x redirect to the new URL.

You can verify it using:

  • Command-line: Run curl -i http://app.example.com and it will show you the server's response. Does it start with "HTTP/1.1 302 Found" or another 30x code? Does it contain a Location: header?

  • Browser: Open a blank tab, open the Developer Tools window (F12 in Chrome), switch to the "Network" section, check the "Preserve log" box. Visit http://app.example.com in the tab and look at what requests/responses show up in Developer Tools.

user1686

Posted 2019-04-22T06:48:24.947

Reputation: 283 655