Welcome! Log In Create A New Profile

Advanced

Re: Problem with uwsgi_no_cache

Francis Daly
August 13, 2015 03:56AM
On Thu, Aug 13, 2015 at 12:06:50AM -0400, daveyfx wrote:

Hi there,

> I'm attempting to exclude application/json data from storing in nginx's
> cache. All other content types are OK to cache. I thought that the below
> config would work for me, but nginx is still caching everything that is
> proxying. What am I doing wrong?
>
> ## in http block ##
> map $http_content_type $no_cache {

$http_ variables refer to the request from the client to
nginx. (http://nginx.org/r/$http_)

You want to care about the response from upstream to nginx.

Look at $upstream_http_ variables (http://nginx.org/r/$upstream_http_)

> default 0;
> "application/json" 1;
> }
>
>
> ## in vhost block ##
> location / {
> uwsgi_cache www;
> uwsgi_cache_valid 200 10m;
> uwsgi_cache_methods GET HEAD;
> uwsgi_cache_bypass $no_cache;

That says "do not read the response from the cache if this is true".

Since you can only sensibly decide that after the upstream response has
been fetched, you probably do not want that here.

> uwsgi_no_cache $no_cache;

That says "do not write to the cache if this is true".

You do want that.

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Problem with uwsgi_no_cache

daveyfx August 13, 2015 12:06AM

Re: Problem with uwsgi_no_cache

Francis Daly August 13, 2015 03:56AM

Re: Problem with uwsgi_no_cache

daveyfx August 15, 2015 01:48PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 185
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready