Skip to content

9: fix: route the fonts directory to the bucket and check it after deploy - #33

Merged
juliantellez merged 1 commit into
mainfrom
9-fix-cloudfront-static-paths
Aug 22, 2026
Merged

juliantellez merged 1 commit into
mainfrom
9-fix-cloudfront-static-paths

Conversation

@juliantellez

Copy link
Copy Markdown
Contributor

What. Routes /fonts/* to the bucket, drops robots.txt and sitemap.xml from that list, and
adds a post deploy check that every face the stylesheet asks for actually resolves.

Why. All five faces returned 404 in production after #32. The site rendered in a fallback and
looked unfinished. s3_patterns in cloudfront.tf listed only BUILD_ID, _next/static/*,
favicon.ico, robots.txt and sitemap.xml, so /fonts/chivo-400.woff2 went to the server
function, which has no route for it and answered 404.

robots.txt and sitemap.xml come off that list for the opposite reason: nothing exists at those
keys, so Origin Access Control refused them and CloudFront returned 403. A 403 on robots.txt is
worse than a 404 for a crawler. They will be served by the application in #9.

On why the tests did not catch it. They could not. next start serves public/ directly, so a
missing route in CloudFront is invisible to any application test. That is the gap this adds a check
for, in the deploy workflow where it belongs: read the stylesheet off the deployed page, extract
every url(/fonts/...), and require a 200 for each.

The application test added here guards the other half, a face referenced but absent from the build.
I mutation checked it by deleting chivo-700.woff2 and watching it report
/fonts/chivo-700.woff2 did not resolve: expected 404 to be 200.

Part of #2. Relates to #9.

@juliantellez juliantellez self-assigned this Aug 22, 2026
@juliantellez
juliantellez merged commit c760c49 into main Aug 22, 2026
2 checks passed
@juliantellez
juliantellez deleted the 9-fix-cloudfront-static-paths branch August 22, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant