Caching not working

Jeff Mitchell jeff at
Tue May 15 01:24:06 UTC 2012


I'm running nginx 1.0.15. I have the following in my http block:

proxy_cache_path /var/tmp/nginx/proxy/cache/quickgit levels=1:2
proxy_temp_path /var/tmp/nginx/proxy/temp;

and in my server block I have (among some other things):

    index index.php;

    error_page 418 = @feed;

    if ( $args ~ a=atom ) {
        return 418;
    if ( $args ~ a=rss ) {
        return 418;

    location @feed {
        include /etc/nginx/fastcgi_params;

        proxy_cache quickgit;
        proxy_hide_header Set-Cookie;
        proxy_cache_key "$scheme$host$request_uri";
        proxy_cache_use_stale error timeout invalid_header updating;
        proxy_cache_valid 200 302 10m;
        proxy_cache_valid 404 1m;
        proxy_cache_valid any 1m;
        proxy_ignore_headers X-Accel-Redirect X-Accel-Expires Expires
Cache-Control Set-Cookie;

        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        fastcgi_read_timeout 300;
        fastcgi_send_timeout 300;

I know that the @feed location is being hit at the appropriate time
because if I put a "return 404" in there I get a 404 page when accessing
the atom/rss URLs. Additionally, nginx creates the correct directories
under /var/tmp/nginx/proxy. However, nothing shows up in the
cache...I've tried tweaking all sorts of parameters (including the
proxy_ignore_headers, even though I only see Set-Cookie coming from the
backend) but nothing has helped.

Thanks in advance,

More information about the nginx mailing list