티스토리 뷰

study/ETC

브라우저 캐싱 비활성화

Jud Lee 2018. 3. 27. 12:25

Response header 에 다음이 설정되어야한다.

Cache-Control: no-cache, no-store, must-revalidate (for HTTP 1.1)

Pragma: no-cache (for HTTP 1.0)

Expires: 0 (for proxies)


Html meta tag

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />

<meta http-equiv="Pragma" content="no-cache" />

<meta http-equiv="Expires" content="0" />

.htaccess (Apache)

<IfModule mod_headers.c>

  Header set Cache-Control "no-cache, no-store, must-revalidate"

  Header set Pragma "no-cache"

  Header set Expires 0

</IfModule>

Java Servlet

response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");

response.setHeader("Pragma", "no-cache");

response.setDateHeader("Expires", 0);

PHP

header('Cache-Control: no-cache, no-store, must-revalidate');

header('Pragma: no-cache');

header('Expires: 0');

ASP

Response.addHeader "Cache-Control", "no-cache, no-store, must-revalidate"

Response.addHeader "Pragma", "no-cache"

Response.addHeader "Expires", "0"

ASP.NET

Response.AppendHeader("Cache-Control", "no-cache, no-store, must-revalidate");

Response.AppendHeader("Pragma", "no-cache");

Response.AppendHeader("Expires", "0");

Ruby on Rails

response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'

response.headers['Pragma'] = 'no-cache'

response.headers['Expires'] = '0'

Python on Flask

resp.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"

resp.headers["Pragma"] = "no-cache"

resp.headers["Expries"] = "0"

Google Go

responseWriter.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")

responseWriter.Header().Set("Pragma", "no-cacghe")

responseWriter.Header().Set("Expires", "0")



댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2026/05   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함