๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๊ฐœ๋ฐœ/Web

[JSP/HTML] ERR_CACHE_MISS ์—๋Ÿฌ ๋ฐœ์ƒ

by ynzu๐Ÿค 2021. 12. 1.
๋ฐ˜์‘ํ˜•

์›นํŽ˜์ด์ง€(jsp, html)์—์„œ ๋’ค๋กœ๊ฐ€๊ธฐ๋ฅผ ํ–ˆ์„ ๋•Œ 'ERR_CACHE_MISS' ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•œ ์ ์ด ์žˆ๋‹ค

 

์ด๋Ÿด ๊ฒฝ์šฐ ์•„๋ž˜์™€ ๊ฐ™์ด ํ•ด๊ฒฐํ•˜๋ฉด ๋œ๋‹ค!

  • jsp๋‚˜ html๊ณผ ๊ฐ™์€ ์›นํŽ˜์ด์ง€ ์ƒ๋‹จ์— header ์ถ”๊ฐ€
response.setHeader("Cache-Control","no-cache);
response.setHeader("Pragma","no-cache");

 

  • spring ์„ค์ •์—์„œ ๊ณตํ†ต์œผ๋กœ ์ฒ˜๋ฆฌ

๋ณธ์ธ์€ csrf ์ฒ˜๋ฆฌ ๋•Œ๋ฌธ์— WebSecurityConfigurerAdapter๋ฅผ ์ƒ์†๋ฐ›์€ classs๊ฐ€ ์žˆ์—ˆ๊ณ , configure ๋ฉ”์†Œ๋“œ๋ฅผ ์˜ค๋ฒ„๋ผ์ด๋“œํ•˜์—ฌ csrf ๋ฐฉ์–ด์ฝ”๋“œ๋ฅผ ์„ธํŒ…ํ•˜์˜€๋‹ค. ๊ทธ๋ž˜์„œ ์ด ๋ถ€๋ถ„์— ์บ์‹œ ๋ฐฉ์ง€ ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ ์ž‘์„ฑํ•จ!

@Override
protected void configure(HttpSecurity http) throws Exception {
	http
		.headers(headers -> headers.cacheControl(cache -> cache.disable()))
		//CSRF ๋ฐฉ์–ด์ฝ”๋“œ
		.csrf().ignoringRequestMatchers(new CsrfIgnoringRequestMatcher(this.excludeUrl));
}

 

 

 

728x90
๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€