Skip to content

next.config headers() appends instead of overriding the default Cache-Control (duplicate header) #12

Description

@hyf0

Problem

A next.config headers() rule is appended after vinext's default Cache-Control rather than overriding it, producing two Cache-Control headers.

Repro

curl -sI http://localhost:3000/fonts/Source-Code-Pro-Regular.woff2 | grep -i '^cache-control'
# Cache-Control: public, max-age=3600                       <- vinext default (first)
# cache-control: public, max-age=31536000, immutable        <- next.config headers() rule

(next.config.js declares an immutable rule for /fonts/:path*.) Per HTTP header-combining rules, a shared cache may take the first max-age (3600), so the intended immutable long-cache can be ineffective.

Suggested fix

A matching headers() rule should replace vinext's default value for that header key, not append a second header.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2: mediumWorth doing, not urgentarea: staticStatic-file serving (MIME, headers)upstream: has-PRA cloudflare/vinext PR already exists

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions