Skip to content

perf(web): static images in public/ are served with max-age=0 #1062

Closed

Description

@JOY

Found in a live header audit of rate.vn (round 5). Unhashed static assets under public/ are served with Cache-Control: public, max-age=0, must-revalidate, and the Vercel edge reports X-Vercel-Cache: MISS:

  • the navbar logo /img/rate-logo-64.png, shown on every page;
  • the device photos /img/devices/*.jpg, which are product images on catalog, product and compare pages;
  • /img/rate-og.png and /favicon.ico.

So every page view makes a conditional request for each of them, one extra round trip per image on a phone, while the hashed /_next/static/* files already get max-age=31536000, immutable.

Fix: a headers() rule in next.config.mjs for /img/:path* and the favicon. Browsers keep the files for a day and reuse a stale copy for a week while revalidating. The file names are not hashed, so the cache is not immutable.

Acceptance: those paths return the new Cache-Control in a production build. HTML, API and /_next/static headers are unchanged. E2E checks it.

Activity

  1. added
    agent:brandClaimed by Agent: Brand
    status:in-progressTask currently claimed and being worked on by an Agent
    status:in-reviewTask completed and waiting for review / PR merge
    and removed
    status:in-progressTask currently claimed and being worked on by an Agent
    on Oct 25, 2026
  2. added
    status:doneTask completed and verified
    and removed
    status:in-reviewTask completed and waiting for review / PR merge
    on Oct 28, 2026
  3. self-assigned this
    on Oct 28, 2026
  4. JOY commented on Oct 28, 2026

    @JOY
    ContributorAuthor

    [Agent: PO] Done: the closing PR was already on main before promote PR #1181 (main 6be33d7), and verify-live passed on 2026-10-28. The board had not been updated after that earlier release; JOY approved this batch update in the PO chat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent:brandClaimed by Agent: Brandarea:frontendFrontend / Next.js / UIstatus:doneTask completed and verified

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions