I am trying to debug the nginx proxy cache and to do so I need to see the $upstream_cache_status
value. My config is as follows:
http { ... proxy_cache_path /tmp/cache_nginx levels=1:2 keys_zone=cfcache:10m max_size=2g inactive=10m use_temp_path=off; ... server { listen 80; listen [::]:80; server_name domain.com; root /home/site/wwwroot; error_log /home/logfiles/nginx/error.log; proxy cache cfcache; add_header Custom-header-test Value; add_header X-Cache-Status $upstream_cache_status always; #index file redirect index index.php; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } # Block access to "hidden" files and directories whose names begin with a # period. This includes directories used by version control systems such # as Subversion or Git to store control files. location ~ (^|/)\. { return 403; } location / { try_files $uri $uri/ $uri.html @php; } location @php { rewrite ^(/[^/]+)$ $1.php last; rewrite ^(/[^/]+)/(.*)$ $1.php?q=$2 last; } #404 error page error_page 404 /notfound.php; location ~ \.php$ { try_files $uri =404; include fastcgi_params; fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_split_path_info ^(.+?\.php)(/.*)?$; fastcgi_connect_timeout 300; fastcgi_send_timeout 3600; fastcgi_read_timeout 3600; fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; fastcgi_intercept_errors on; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/site/wwwroot$fastcgi_script_name; } #cache static files location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|svg+xml)$ { expires max; log_not_found off; } } }
Custom-header-test
is appearing as expected, with the value Value
X-Cache-Status
on the other hand is not appearing on any requests, why is that? How can I get it to appear?