Backend2025년 4월 30일1분 읽기

HTTP 캐시 전략 — Cache-Control 완벽 이해

YS
YoungSam
조회 1500

Cache-Control 디렉티브

// 정적 자산 (변경 불가 — 해시된 파일명)
Cache-Control: public, max-age=31536000, immutable

// API 응답 (재검증 필수)
Cache-Control: no-cache
// 또는
Cache-Control: max-age=0, must-revalidate

// 민감한 데이터 (캐시 금지)
Cache-Control: no-store

조건부 요청

  • ETag: 컨텐츠 해시 기반 검증
  • Last-Modified: 수정 시간 기반 검증

304 Not Modified 응답으로 대역폭을 절약합니다. stale-while-revalidate를 활용하면 UX를 더 개선할 수 있습니다.

HTTPCachePerformance

댓글 0

아직 댓글이 없습니다.