Aws Route 53 Domain Point to Github Pages

I am new to working with AWS and route 53 so any help is appreciated.

I have created an organization on GitHub, and then created a simple repository for a static site to display with Github pages. this is working as expected and I can see the static site at the URL generated by Github (something like: )

I got a domain from AWS and now I'm trying to set it up so the apex domain (e.g. "my-domain.com") points to the Github pages site.

I followed the instructions found at: ... but it doesn't seem to be working.

I am trying to make it so that the apex domain points to the repository Github page. something like:

->

... but this only shows a blank screen when I go to the root domain ("my-domain.com"). I have also tried to go to ... but this shows me a Github 404 page (so it seems to be correctly forwarding something to Github):

my AWS route 53 configuration is similar to the following (i have tried to remove sensitive details):

can anyone explain to me what I am doing wrong? I am new to working with domains so any help is appreciated.

0

1 Answer

Using Route53 alone won't help you there, because your target URL contains a URL path i.e. /<repoName>/.

DNS is a name resolution system and knows nothing about HTTP

Furthermore, the origin server (github.io) might be running a reverse proxy which might be parsing the request headers, among which is the Host header. You browser automatically sets this header to the url you feed it. Eventually, you send it the wrong header (i.e. ), which Github cannot process. You can explicitly set this header (e.g. via curl) to what Github is expecting, but I believe it's not what you and your users would like.

Instead, you could try using layer 7 redirects (301/302) with the help of Lambda@Edge (provided by AWS CloudFront). I have created a simple solution using the Serverless framework, which does the following redirects:

     ->  
  ->  
  ->  
  ->  

But you can customize it by adjusting handler.js according to your needs. You might also need to create a free TLS certificate using AWS Certificate Manager in the us-east-1 region and attach it to your CloudFront distribution. But this is optional.

Lambda@Edge will give low latencies, since your redirects will be served from CloudFront's edge locations across the globe.

Your Answer

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

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest