Setting up website via Github Pages + Cloudflare

I’ve been looking at a few guides as I’m running into trouble. Previously I had the same domain setup using namecheap and cloudflaree, but not github. Rather it was using Notion (steps here).

I decided to push my own website using Github but I’ve gotten a bit confused as it’s not working. On step 5 of Freecodecamp’s guide it says to setup DNS records, but I’m not sure where to get those DNS records.

When looking at the cloudflare DNS settings I’m seeing the following DNS records (text blacked out is my domain):

To be clear, I’m using Namecheap, Github Pages, and Cloudflare.

Any clue what I’m missing or not doing correctly?

Did you point to Cloudflare by adding Cloudflare nameservers in Namecheap DNS records?

Cloudflare Nameservers

To use Cloudflare, ensure your authoritative DNS servers, or nameservers have been changed. These are your assigned Cloudflare nameservers.

1 Like

Yeah I actually added the two under NAMESERVERS → Custom DNS

Is it normal to have that many records under Cloudflare DNS management ?

Normally at least 3 records.

MX for mail
A for www (sub domain)
A for main domain

And in my case 6 extra A for sub domains plus some “validation strings” in TXT. But this may vary depending on your case.

It’s strange. I’m seeing that there have been visits, but the website itself does not load. Custom DNS on Namechaep is the same as the one on Cloudflare, my Github checks DNS and passes it, but I’m my website is still not loading

I feel it must be something with my past setup but I don’t have a clue what to do. What do you recommend?

When I experience this (it happens now and then), it is almost an error in my code of the website. A needed link that is missing, an error in the code or something like this. Does the site work on your computer?

I track this error by reducing my site to ONE single page as simple as possible. Or you can comment out some parts of your home page And sometimes use only a “Hello World” page using a couple of lines of code. Then I add code and pages successively until I find the error.

I run a test on web.dev on your site and this may confirm my theory:

Error: Error: Lighthouse returned error: FAILED_DOCUMENT_REQUEST. Lighthouse was unable to reliably load the page you requested.

The website runs perfectly on my computer without error actually. Assuming that means the code is not the issue

I feel it may be an issue with the past setup as I mentioned below?

What am I supposed to do to migrate from the Fruition/Notion setup (or probably any setup as I’m sure you haven’t used either with hosting) to my own code?

I am always assuming my code is correct. Normally it is. But sometimes I forget to move all parts to the server. One single missing linked document (CSS or whatever) can ruin my “perfect” code. :slight_smile: Hence I reduce the code to almost nothing in order to track down the problem.

FAILED_DOCUMENT_REQUEST

When a simple “Hello Word” page works, I know that I have missed something on my side. Normally a link to something is the problem. If not “Hello World” without links works, I look into other causes.

<!DOCTYPE html>
<html>
    <head>
        <title>Example</title>
    </head>
    <body>
        <p>Hello World :-)</p>
    </body>
</html>

And finally another thing I always forget. Set Cloudflare into “developer mode” and purge the cache. And empty your browser cache. Otherwise you do not see your changes for several hours. And in my case I also have to restart the my web server (not the entire server) to pick up the changes.

1 Like

So to be clear you’re saying there’s for sure an issue with my code because you’re getting the “FAILED_DOCUMENT_REQUEST” error somewhere, even though the same exact HTML file runs perfectly on my computer?

I’m confused how this could happen, maybe something went wrong when pushing it to the repository?

To be honest, I think your code is perfect. But there could be one or more documents (links) that may be missing. Hence the Hello World suggestion…

Another thing (not likely, but possible) is that your uploaded documents (HTML etc) have wrong permissions = “not readable”.

1 Like

Hey finally found the issue. I didn’t have the right dns setting on Cloudflare! Sorry I’m a noob :grinning_face_with_smiling_eyes:

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.