Proxy cache doesn't work in regex location?

Jeff Mitchell jeff at
Fri Jan 28 07:12:17 MSK 2011


I have the following two blocks:

    location ~* \.atom$ {
        proxy_pass http://thin_projects_cluster;
        proxy_cache projects;
        proxy_cache_valid 200 10m;
        proxy_cache_use_stale off;
        #return 404;

    location / {
        proxy_pass http://thin_projects_cluster;
        #proxy_cache projects;
        #proxy_cache_valid 200 10m;
        #proxy_cache_use_stale off;

If I comment out everything in the top block and uncomment the "return
404" then I get 404 errors when accessing URLs ending in .atom, so I
know that that regex is successfully matching some of my content.

That said, the problem I have is that the cache is not working for the
top block, but if I comment the cache statements in the top block and
uncomment the cache statements in the bottom block, the cache starts
populating as expected. I can't figure out what the difference is.

Does anyone know what might be going on?


More information about the nginx mailing list