Welcome! Log In Create A New Profile

Advanced

proxy_cache works fine but no $upstream_cache_status

Posted by snorlax 
proxy_cache works fine but no $upstream_cache_status
June 17, 2019 10:55AM
My relevant setting:

proxy_cache_path /tmp/cache levels=1:2 keys_zone=zone:10m
inactive=24h max_size=1g;

upstream backend {
server xx.xx.xx.xx:xxx;
keepalive 16;
}

server {
...

location ^~ /frontend {
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_revalidate on;
proxy_cache zone;
proxy_cache_valid 200 404 2s;
proxy_cache_use_stale updating;
proxy_cache_background_update on;
proxy_cache_lock on;
add_header X-Cache-Status $upstream_cache_status;
}

}

I checked `/tmp/cache` and there are directories automatically generated there.
I tested and yes, the cache works fine. But no `X-Cache-Status` in response headers. I wonder why `$upstream_cache_status` returns an empty value?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 98
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready