Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Serve hashed /_next/static/* as immutable in public/_headers

オープン 初心者向け
#332 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
67/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
next.js, typescript
領域
devops

調査の方向性

public/_headers を読み、既存のキャッシュルールを確認します。out/ 内の /_next/static/ 以下にあるビルド済みパスを調べ、コンテンツハッシュが付いていることを確認します。次に、提案されたルールを追加し、デプロイ後に curl -sI で Cloudflare Pages がそのルールを適用していることを検証します。ハッシュ付きアセットに不変の1年間のポリシーが適用され、列挙された HTML ファイルとメタデータファイルが現在のキャッシュなしの動作を維持すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

enhancement

Current

Cloudflare Pages serves the content-hashed build assets with its default policy:

$ curl -sI https://decdn.org/_next/static/chunks/101w7am0t3tuy.css | grep -i cache-control
cache-control: public, max-age=14400, must-revalidate

The JS chunks are the same. On every reload the browser revalidates the stylesheet with a conditional request before it can apply it. That round-trip is the window in which Firefox has been seen painting the page unstyled (#331). It also adds a revalidation per asset on repeat visits after 4 h.

Proposal

Add a rule to public/_headers:

/_next/static/*
  Cache-Control: public, max-age=31536000, immutable

Next's /_next/static/ filenames change with their content, so a long-lived immutable cache is safe. A deploy that changes the CSS emits a new filename, and the HTML (still max-age=0, must-revalidate) points at it.

Checks

  • Confirm Cloudflare Pages lets a _headers Cache-Control override its default for these paths (Pages docs; verify with curl -sI after deploy).
  • Confirm nothing un-hashed lives under /_next/static/ in out/. next/font files under /_next/static/media/ are hashed too.
  • Keep the HTML, robots.txt, sitemap*.xml and llms*.txt uncached as they are.
主要言語
TypeScript
スター
3
フォーク
0
平均マージ
12時間 41分
マージ済み PR(30日)
70

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

decdn/website のほかの issue

decdn/website の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。