Problem with uwsgi_no_cache

daveyfx nginx-forum at nginx.us
Sat Aug 15 17:48:36 UTC 2015


Thank you, Francis.  For anyone wondering what my corrected configuration
looks like, here it is.

All the JSON content returned by the upstream is now ignored and only
caching HTML content as desired.

## cache zone config ##
uwsgi_cache_path /var/cache/nginx/files keys_zone=www:10m inactive=10m;
uwsgi_cache_key "$scheme$host$uri$is_args$args";

## in http block ##
map $upstream_http_content_type $no_cache {
    "application/json" 1;
    default            0;
}


## in server block for my vhost ##
    location / {
        uwsgi_cache www;
        uwsgi_cache_valid 200 10m;
        uwsgi_cache_methods GET HEAD;
        uwsgi_no_cache $no_cache;
        add_header X-uWSGI-Cache $upstream_cache_status;
        include uwsgi_params;
        uwsgi_pass www;
    }

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,260977,261032#msg-261032



More information about the nginx mailing list