I want to cache all api endpoints except of one: /api/search endpoint.
Please not I removed settings not related to question to minify the post!
server {
listen 8000 default_server;
# Set Cache for my Json api
# I want to cache everything but /api/search endpoint
location ~* \.(?:json)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
location /api {
include uwsgi_params;
uwsgi_pass unix:/var/www/awesome3-gamma/app.sock;
allow [MY DNS];
deny all;
}
}
# Set cache dir
proxy_cache_path /tmp/nginx levels=1:2 keys_zone=my_zone:10m inactive=60m;
proxy_cache_key "$scheme$request_method$host$request_uri";
# Virtualhost/server configuration
server {
listen 80 default_server;
# here I cache /api
# how to avoid caching /api/search ?
location /api {
add_header X-Proxy-Cache $upstream_cache_status;
proxy_cache my_zone;
proxy_cache_use_stale updating;
proxy_cache_lock on;
proxy_cache_valid 30d;
proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
proxy_pass [my site route api]
}
}
I am looking at:
but got error 500.