Problem with uwsgi_no_cache
daveyfx
nginx-forum at nginx.us
Thu Aug 13 04:06:50 UTC 2015
Hi all -
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 {
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;
uwsgi_no_cache $no_cache;
add_header X-uWSGI-Cache $upstream_cache_status;
include uwsgi_params;
uwsgi_pass www;
}
I've tried a few other ways to set $no_cache to 1 for json content. Tried
the following in both the server block and the location / block.
if ($http_content_type = "application/json") {
set $no_cache 1;
}
Here's my build:
nginx version: nginx/1.6.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid
--lock-path=/var/run/nginx.lock
--http-client-body-temp-path=/var/cache/nginx/client_temp
--http-proxy-temp-path=/var/cache/nginx/proxy_temp
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
--http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx
--with-http_ssl_module --with-http_geoip_module --with-http_realip_module
--with-http_stub_status_module --with-file-aio --with-ipv6
--without-http_ssi_module --without-http_split_clients_module
--without-http_referer_module --without-http_scgi_module
--without-http_browser_module --without-mail_pop3_module
--without-mail_imap_module --without-mail_smtp_module
--add-module=/home/makerpm/rpmbuild/BUILD/nginx-1.6.2/mod/ngx_http_redis-0.3.7
--add-module=/home/makerpm/rpmbuild/BUILD/nginx-1.6.2/mod/nginx-x-rid-header
--add-module=/home/makerpm/rpmbuild/BUILD/nginx-1.6.2/mod/nginx-upload-module
--add-module=/home/makerpm/rpmbuild/BUILD/nginx-1.6.2/mod/nginx-upload-progress-module-0.8.4
--add-module=/home/makerpm/rpmbuild/BUILD/nginx-1.6.2/mod/echo-nginx-module-0.57
--with-ld-opt=-luuid --with-http_spdy_module --with-cc-opt='-O2 -g -pipe
-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic'
Thanks for your help.
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,260977,260977#msg-260977
More information about the nginx
mailing list