Network/HTTP

[HTTP]캐시무효화

seung_soos 2023. 4. 13. 15:57

Cache-Control

  • Cache-Control : no-cache, no-store, must-revalidate
  • Pragma : no-cache(HTTP 1.0 하위 호환)

캐시 지시어

  • Cache-Control : no-cache
    • 데이터는 개시해도 되지만, 항상 원래 서버에 검증하고 사용
  • Cache-Control : no-store
    • 데이터에 민감한 정보가 있으므로 저장하면 안됨(메모리에서 사용하고 최대한 빨리 삭제)
  • Cache-Control : must-revalidate
    • 캐시 만료 후 최초 조회시 원래 서버에 검증해야함.
    • 원래 서버 접근 실패시 반드시 오류가 발생해야함 - 504(Gateway Timeout)
    • must- =revalidate는 캐시 유효 시간이라면 캐시를 사용함
  • Pragma : no-cache
    • HTTP 1.0 하위 호환