🚀 新規事業

cache-control-headers

最終更新 2026年05月08日 / 40_新規事業/SCALE_Build/カタログ/基本装備集/cache-control-headers.md

Cache-Control ヘッダ

何のために?

新版デプロイしたのに、ユーザーが旧版を見続ける = 改修が反映されない。

どう実装する?

public/_headers で /index.html を no-cache、/_assets/ を long-cache。

コード例

# public/_headers
/
  Cache-Control: public, max-age=0, must-revalidate
/index.html
  Cache-Control: public, max-age=0, must-revalidate
/_assets/*
  Cache-Control: public, max-age=31536000, immutable
/*.js
  Cache-Control: public, max-age=31536000, immutable
/*.css
  Cache-Control: public, max-age=31536000, immutable