HTTP 캐시 헤더(Cache-Control, ETag 등)를 어떻게 설정해야 하나요?
HTTP 캐싱 전략: 1) 정적 파일(JS/CSS/이미지): Cache-Control: public, max-age=31536000, immutable + 파일명에 해시 포함. 2) HTML: Cache-Control: no-cache (항상 서버 확인, ETag로 304 반환). 3) API: Cache-Control: private, max-age=60 (또는 no-store). 4) CDN: s-maxage=3600 (CDN 캐시), stale-while-revalidate=86400 (백그라운드 갱신).
댓글 1
HTTP 캐싱 전략: 1) 정적 파일(JS/CSS/이미지): Cache-Control: public, max-age=31536000, immutable + 파일명에 해시 포함. 2) HTML: Cache-Control: no-cache (항상 서버 확인, ETag로 304 반환). 3) API: Cache-Control: private, max-age=60 (또는 no-store). 4) CDN: s-maxage=3600 (CDN 캐시), stale-while-revalidate=86400 (백그라운드 갱신).