개발

nginx proxy cache STALE 설정 - proxy_cache_use_stale

소밍소밍 2022. 7. 21. 22:24

nginx proxy cache를 사용할 때 STALE이라는 상태값을 받을 때가 있다. 

stale이란 '신선하지 않은' 이라는 뜻으로, 응답이 정상적이지 않을 때, 이미 저장되어 있는 캐시를 대신 응답한다는 것을 의미한다.

어떤 경우에 STALE을 사용할지는 nginx.conf에서 설정할 수 있다.

proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;

 

proxy_cache_use_stale은 default off이기 때문에 stale인 케이스를 정의하고 싶다면 설정값을 입력만 하면 된다.

 

공식 문서는 여기

https://www.nginx.com/blog/nginx-caching-guide/#stale

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_use_stale