Setting apex custom domain for github pages

0

I purchased a domain and want to associate it with a github.io url. I'm having difficulties configuring my DNS for the custom domain to point to the Github domain.

In the github documentation it says "you must configure an ALIAS, ANAME, or A record with your DNS provider."

Amazon Route 53 seems to only have the A record so I need to use that. The problem is that A records seem to only take an IP address. I have been unable to find a correct ip that correlates with my github.io url.

I ran a dig command to get the ip and it gives me an ip. When I visit this ip however it 404s.

I have also used the host command and sites that lookup ip addresses but they all give me the same 404ing ip

chackerian

Posted 2016-07-16T20:13:56.920

Reputation: 103

Answers

1

I ran a dig command to get the ip and it gives me an ip. When I visit this ip however it 404s.

That's to be expected. Github has not allocated an IP address just for your site -- the web browser sends a Host: header with each request to tell the web server which site is being requested. Typing the IP address into the browser causes the IP address to be sent, so the server has no idea which of millions of possible sites you want.

Use this address, and create a normal A record. Your site should work fine.

Route 53 does have Alias records, but this is only relevant when the target is another AWS service, like S3, CloudFront, or Elastic Load Balancer.

Michael - sqlbot

Posted 2016-07-16T20:13:56.920

Reputation: 1 103

Use what address? – chackerian – 2016-07-17T11:32:25.367

Whatever address you were talking about that gives 404s. – Michael - sqlbot – 2016-07-17T15:32:37.450

I was confused before because I thought this address wouldn't work since it was 404ing. I guess it works differently in DNS records. – chackerian – 2016-07-27T01:03:11.150

No... the site examines the HTTP Host header, sent by the browser and populated with the address shown in the address bar to decide which site you are asking for. That's generally how web servers work, and the only way they can work at all when more than one hostname points to the same IP address. When it sees that header populated with an IP address, it's going to respond with some kind of error, because it has no idea which site you actually want. Github chooses to return 404 but a number of other errors like 503 Service Unavailable or 403 Forbidden would also be valid in this case. – Michael - sqlbot – 2016-07-27T03:16:29.493