News for hackers. Stuff that matters.
Re:The ThinkPad P14s by ggreer on Sunday January 07, 2024 @05:27PM (#38905829)
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....

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.

Re:The ThinkPad P14s by soxocx on Sunday January 07, 2024 @05:52PM (#38906062)
If 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.
Re:The ThinkPad P14s by tuukkah on Sunday January 07, 2024 @05:59PM (#38906125)
Last 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/ma...

There's an open GitLab issue: 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.

Re:The ThinkPad P14s by utkarsh-singh on Tuesday January 09, 2024 @08:24AM (#38925885)
Yes, you're on spot! Surely, I can try this workaround. Do you have any references for this workaround?
Re:The ThinkPad P14s by kuschku on Sunday January 07, 2024 @07:04PM (#38906572)
And this "solution" doesn't work without JS at all...