3 ms·
I'm guessing the author's website is misconfigured. Every path except the root returns an HTTP 404, but the 404 page loads some JavaScript that fetches assets b
by ggreer 3y ago
I'm guessing the author's website is misconfigured. Every path except the root returns an HTTP 404, but the 404 page loads some JavaScript that fetches assets based on the URL. For example, the ThinkPad blog post loads https://utkarshsingh.xyz/assets/thinkpad-p14s/thinkpad-p14s.md https://utkarshsingh.xyz/assets/thinkpad-p14s/thinkpad-p14s....
This mostly works, but some browsers will display a warning or their own 404 page. Also it means his site won't be indexed in search engines.
- soxocx 3y agoIf not done correctly, that is the default result with Cloudfront + S3. You set the index and error page to your index.html. That way you get SPA routing but a 404 for all non root routes. The author needs to add a Lambda to rewrite the HTTP response depending on the route, some 404s should be rewritten to be 200s.
- tuukkah 3y agoLast I checked, this was inevitable if you publish a SPA on GitHub Pages, like the author is doing (GitLab not GitHub, but probably similar): https://gitlab.com/utkarsh181/utkarsh181.gitlab.io/-/blob/main/src/404.html?ref_type=heads https://gitlab.com/utkarsh181/utkarsh181.gitlab.io/-/blob/ma... There's an open GitLab issue: https://gitlab.com/gitlab-org/gitlab-pages/-/issues/57 https://gitlab.com/gitlab-org/gitlab-pages/-/issues/57 Workaround: Publish the artefacts from CI/CD to Netlify or similar, where you can configure URL rewrites.
- utkarsh-singh 3y agoYes, you're on spot! Surely, I can try this workaround. Do you have any references for this workaround?
- kuschku 3y agoAnd this "solution" doesn't work without JS at all...