map $upstream_cache_status $cache_status {
  'HIT' 'HIT';
  default $upstream_http_x_cache_status;
}
server {
  server_name edge;
  proxy_cache cache_1;
  proxy_cache_key $host$uri;
  proxy_cache_valid 200 206 301 302 10s;
  add_header X-Cache-Status $cache_status;
  proxy_hide_header X-Cache-Status;
  proxy_set_header Host relay;
  location / {
    proxy_pass http://relay;
  }
}
server {
  server_name relay;
  proxy_cache cache_1;
  proxy_cache_key $host$uri;
  proxy_cache_valid 200 206 301 302 10s;
  add_header X-Cache-Status $upstream_cache_status;
  proxy_hide_header X-Cache-Status;
  proxy_set_header Host origin;
  location / {
    proxy_pass http://origin;
  }
}내 값이 HIT가 아니면, 윗 relay의 값을 참조하게 설정했다.
마지막 relay는 upstream 값이 없기에, 무조건 기본 값으로 넣어야한다.
'메모 메모' 카테고리의 다른 글
| DB 리스트 수정 시 프로세스 고민 (0) | 2024.09.09 | 
|---|---|
| nginx log를 5분 단위로 작성하기 (0) | 2024.05.13 | 
| NGINX 로깅 시스템 메모 (0) | 2024.05.13 | 
| 소시지는 에어프라이에 140도 20분 (2) | 2024.05.09 | 
| 모니터암은 듀얼 말고 싱글X싱글 (0) | 2024.05.07 | 





























