Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is CNAME file needed in github pages repository even I have the CNAME record at DNS provider?

I'm confused why CNAME file is also needed in my github pages repository? Why CNAME needs to be done twice at my domain provider and github pages?

How the things works together?

like image 852
Aaron Shen Avatar asked Sep 16 '25 17:09

Aaron Shen


1 Answers

When a http request comes in, saying the request is for mygithub.mypage.com, github has to know on whose behalf this request is for, so whose page it has to deliver.

This is what the setting at github is for.

To be exact, what github's server sees is a http request like

GET / HTTP/1.1
Hostname: mygithub.mypage.com

There is no notion about mypage.github.io. They could do a DNS query to find out where mygithub.mypage.com points to, but they chose to use this version.

like image 56
glglgl Avatar answered Sep 19 '25 07:09

glglgl