Nginx plus cache invalidation problem

Keferoff nginx-forum at nginx.us
Wed Dec 3 08:45:56 UTC 2014


Добрый день!
nginx не инвалидирует кеш по патерну.
- версия nginx:  version: nginx/1.7.3 (nginx-plus-extras-r4-p1)
- запрос инвалидации кеша: curl -X PURGE -D -
"http://i.xxxxxx.yy/html/*-test/*"

upstream s3 {
  keepalive 10;

  server lm-zzzzzzzz-eu-west.s3-eu-west-1.amazonaws.com fail_timeout=0;

  zone s3 512k;
}

proxy_cache_path /tmp/cache
  levels=1:2
  keys_zone=S3_CACHE:1024m
  loader_threshold=300
  loader_files=200
  inactive=120m;

map $request_method $purge_method {
  PURGE   1;
  default 0;
}

server {
  server_name i.xxxxxx.yy;

  status_zone s3;

  add_header X-Proxy-Cache $upstream_cache_status;

  location / {
    try_files $uri @s3;
  }

  location ~ .mp4$ {
    mp4;
    mp4_buffer_size 1m;
    mp4_max_buffer_size 15m;

    try_files $uri @s3;
  }

  location @s3 {
    proxy_set_header        Host
lm-zzzzzzzz-eu-west.s3-eu-west-1.amazonaws.com;
    proxy_set_header        Authorization '';
    proxy_hide_header       x-amz-id-2;
    proxy_hide_header       x-amz-request-id;
    proxy_hide_header       Set-Cookie;
    proxy_ignore_headers    "Set-Cookie";
    proxy_intercept_errors  on;

    proxy_cache             S3_CACHE;
    proxy_cache_valid       200 168h;
    proxy_cache_valid       403 1h;
    proxy_cache_bypass      $http_cache_purge;
    proxy_cache_purge       $purge_method;

    proxy_http_version      1.1;
    proxy_set_header        Connection "";
    proxy_pass              http://s3;
  }
}

Заранее спасибо!

Posted at Nginx Forum: http://forum.nginx.org/read.php?21,255282,255282#msg-255282



Подробная информация о списке рассылки nginx-ru