Score:1

How do you set an A record for any shared host?

gq flag

I'm trying to use an A record to redirect my domain to a separate domain that I own. This process has worked fine with DigitalOcean Droplets -- I just add their IPv4 address in the A record and the request goes straight through to whatever the Droplet is hosting.

However, the website I'm trying to send the request to is operated with shared hosting, so the IP address I got by pinging my website is actually a broader one that does not link to the website, but rather a landing page for anybody who uses the server that the site is hosted on.

I get the same thing while trying to use a GitHub Pages/Cloudflare pages site -- just 404s as I'm probably querying the underlying server and not the webpage they're being served on.

My question is two-part:

  1. Why does this work on DigitalOcean and not GitHub/Cloudflare? I was under the assumption that Droplets are shared hosting as well, but maybe not...?
  2. Is there any other way to do a redirect/have a page hosted without having to buy an entire separate droplet?
Score:1
in flag

How do you set an A record for any shared host?

You set an A record for a shared host the same way as you do for any other host, there is no difference, you use the correct IP-address(es) and you're done.

But there's several issues there and you're probably asking the wrong question:

  • Unless the shared hosting platform both explicitly supports adding additional/custom domains to existing hosting plans and you have registered your new domain in your hosting plan, the platform won't actually recognise your additional domain.
    Generally shared platforms need to be configured to associate domain names with specific accounts and otherwise won't respond correctly as evidenced by the generic landing page that gets displayed.

  • I imagine that a shared hosting platform won't provide you with a "correct IP-address" for you to use in your A record in the first place, as they'll be using a CDN service and/or will want to be able to change IP's at will without breaking your hosting. (Often they'll recommend setting up a CNAME record instead of an A record, with the problem that CNAME's can't be used for a bare domain / apex.

This process has worked fine with DigitalOcean Droplets. Why does this work on DigitalOcean and not GitHub/Cloudflare? I was under the assumption that Droplets are shared hosting as well, but maybe not...?

Probably because you never configured a default landing page on your droplets. When you don't explicitly configure a landing page (in web server jargon: "default virtual host") the first/only website becomes the default web site that will always get displayed.
That site will not only show when the correct site name is used, that will also be the site shows when for example the bare IP-address of the server is used, or also when any random, unknown domain name that gets pointed at your server's IP-address is used.

Is there any other way to do a redirect/have a page hosted without having to buy an entire separate droplet?

Use name based virtual hosting on an existing droplet of yours.

Andrew avatar
gq flag
Thanks! I see -- that makes much more sense that the droplets are simply forwarding all traffic to whatever I had configured + the platform would want the flexibility to change the IP if they wanted to. I know some platforms offer 'dedicated IPs', would those (in this context) just be unchanging addresses?
HBruijn avatar
in flag
Possibly. That depends on the platform and use-case.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.