Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

JSON data files not properly cached #581

@thchia

Description

@thchia

Describe the bug
JSON data files for SSG pages (e.g. `_next/data/{build id}/file.json) are not being cached by Cloudfront, meaning that subsequent calls always go to the origin (and trigger the Lambdas@Edge).

To Reproduce

  1. Deploy a website with at least one SSG page.
  2. Visit the SSG page once. This should cache the JSON data.
  3. Refresh that page and observe the x-cache response header set to Miss from cloudfront

Expected behavior
On step 3 above, we should observe Hit from cloudfront

Additional context
During the upload of these files, no Cache Control is set, which I suspect is the underlying cause. There should be no concern about caching these for a long time, since the build ID is in the path and SSG data should not vary within a single build.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions