3

Update2: add uwsgi_ignore_headers Cache-Control Set-Cookie X-Accel-Expires Expires Vary; and problem solved. Thanks everyone.

Update: I tried uwsgi_ignore_headers Cache-Control Set-Cookie X-Accel-Expires Expires Vary;. Doesnot work. I also find that, if I make same request in the logout state from different browsers on the same computer, the cache still doesnot work. This is really silly...

I've seen the comments below, but I don't know how to apply it to the config file.

I want to cache url /, it works well but I find that if I login or logout, the cache doesnot work. why? I just want to cache / anyway. Here is my cofiguration:

uwsgi_cache_path uwsgi_cache_path /app/path/nginx_cache levels=1:2 keys_zone=my_cache:1m max_size=50m inactive=30m use_temp_path=off;

server {
...

    location = / {
        uwsgi_pass  127.0.0.1:3032; 
        include     /app/path/uwsgi_params;
        uwsgi_cache my_cache;
        uwsgi_cache_key "$host$uri$is_args$args";

        uwsgi_cache_valid 5m;

    }
...

}
xiang
  • 33
  • 4
  • 1
    Most likely your UWSGI app is sending some headers that forbid nginx to cache the content. Ideally you should remove those from the app or set nginx to ignore them. – Florin Asăvoaie Jan 07 '16 at 09:10
  • 1
    You would have to post the headers of those requests and the contents of /app/path/uwsgi_params – JayMcTee Jan 07 '16 at 10:30
  • @JayMcTee could you be more detailed? how to implement this in the nginx config file? – xiang Jan 07 '16 at 14:14
  • 1
    I was saying you need to be more detailed. You need to post the contents of that include file plus ideally some example headers of requests where this behaviour occurs. – JayMcTee Jan 07 '16 at 14:16

0 Answers0