🌐 GitHub Pages: Static Deploy, Custom Domain and SPA Fallback

GitHub Pages: Static Deploy, Custom: GitHub Pages is like a vending machine for your website: you load the pre-packaged products (HTML, CSS, JS files) into the slots, the machine

GitHub Pages is like a vending machine for your website: you load the pre-packaged products (HTML, CSS, JS files) into the slots, the machine dispenses them on demand to anyone who walks up — but it cannot cook anything fresh, it can only serve what was already sealed inside. The "why" question that sharpens the concept: if you have a React app that works perfectly in your browser after `npm run build`, why does directly opening the `/login` URL on Pages return a 404? Because Pages is a file server, not a router — it looks for a literal file at `dist/login/index.html`, but a Single Page Application has only one real HTML file (`dist/index.html`) and handles all routing in JavaScript. Java analogy: deploying to GitHub Pages is the opposite of deploying a Spring Boot JAR — a JAR brings its own embedded Tomcat server that handles dynamic routes at runtime, while Pages deployment is like publishing only the static assets that Tomcat would have served, with no Tomcat present. For QA, this means automated tests that hit `/dashboard` directly via `page.goto()` will fail on the deployed Pages site unless you have added a static fallback shell for that route — a gap that only shows up in end-to-end tests against the deployed URL, not in local dev.

github-pages-settings-ui

GitHub Pages settings screen: source, domain, HTTPS and live site

See where Pages lives inside Settings and what Visit site, Unpublish site, Source, Custom domain, Save, Remove and Enforce HTTPS do.

What do the Pages screen controls do?

Try It Yourself: Configure Pages in a safe order

Practice the correct order for source, custom domain and HTTPS on the GitHub Pages settings screen.

Open the Settings tab from the repository top nav

Choose Pages in the left menu

Choose GitHub Actions as the source

Fill the custom domain field

Save the domain setting

Enable Enforce HTTPS

Verify the live site with Visit site