Skip to content

fix(vercel): cache the hashed docs assets - #4930

Merged
thetaPC merged 1 commit into
mainfrom
cache-hashed-assets
Dec 2, 2026
Merged

thetaPC merged 1 commit into
mainfrom
cache-hashed-assets

Conversation

@thetaPC

@thetaPC thetaPC commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Docusaurus puts a content hash in every file under /docs/assets/, but Vercel serves them with max-age=0. Cloudflare then caches none of them, so every request for the site's JS and CSS goes through nginx to Vercel. That adds to the same traffic from a few proxy IPs that triggers Vercel's challenge.

  • Caches /docs/assets/* and /docs/ja/assets/* for a year as immutable
  • A changed file gets a new hash, so a long cache can't serve stale code

Follows #4927, which did the same for the demo images.

How to test

Use the preview URL, not ionicframework.com, which can return the challenge page. That page is no-store and hides the header.

  1. Open the preview and copy any /docs/assets/js/main.<hash>.js URL from the page source
  2. curl -sI <that URL> | grep -i cache-control prints public, max-age=31536000, immutable

Previews build English only, so /docs/ja/assets/ can only be checked after the production deploy.

@vercel

vercel Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ionic-docs Ready Ready Preview Dec 2, 2026 11:08pm UTC

Request Review

@thetaPC
thetaPC marked this pull request as ready for review December 2, 2026 23:22
@thetaPC
thetaPC requested a review from a team as a code owner December 2, 2026 23:22
@thetaPC
thetaPC requested a review from brandyscarney December 2, 2026 23:22
@thetaPC
thetaPC merged commit cdea601 into main Dec 2, 2026
7 checks passed
@thetaPC
thetaPC deleted the cache-hashed-assets branch December 2, 2026 23:23

This branch was successfully deployed

1 active deployment
Preview — 9fab54c2 Deployed Dec 2, 2026 by vercel[bot]
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.

2 participants