title: Nginx cache status header doesn't work even though fastcgi_cache does
body: <p>I've got Nginx 1.4.1 and PHP 5.5.7 on Ubuntu 12.04.  Nginx is compiled with the necessary extras.  I've set up fastcgi_cache and installed Wordpress as a test site.  I"m also using the <a href="http://wordpress.org/plugins/nginx-helper/" rel="nofollow">Nginx Helper plugin</a> for WP.  I've slimmed down the configs to the bare essentials in an attempt to debug.  The fastcgi_cache appears to be working as I created a php file that outputs time and called it several times from CURL and it shows the same output each time. The cache location is also filling up with files, and empties when I purge it.  </p>
  
  <p>What doesn't work, and I've tried every configuration I can think of, is the "add_header X-Cache $upstream_cache_status;"  When added to the HTTP block of nginx.conf, it is supposed to add "X-Cache = HIT or MISS, or BYPASS or something.  I can't get it to show up at all.  I've checked other servers that I know are using this cache and the header does show up. I could go along and just ignore it but I like to know why something isn't working in case more is going on lest it come back to bite me later.</p>
  
  <p>I suppose it could be a genuine bug, but I've not been able to find any reference.  Information on this is scarce, so I've turned to the brain trust -- any ideas?  Config files below. FYI, I tried putting the add_header line in a server block and location block just to be sure - no joy.</p>
  
  <p><strong>example.com.vhost</strong></p>
  
  <pre><code>fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=MYAPP:100m inactive=60m;
  fastcgi_cache_key "$scheme$request_method$host$request_uri";
  
  add_header X-Cache $upstream_cache_status;
  
  server {
      listen   80;
      server_name ~^(?:www\.)?(?P&lt;example.com&gt;.+)$ ;
      root /srv/www/$domain/htdocs;
      index index.php
  
      server_name example.com;
  
  
      location / {
          try_files $uri $uri/ /index.html;
  
      }
  
      location ~ \.php$ {
          try_files $uri =404;
          fastcgi_pass unix:/var/run/php5-fpm.sock;
          fastcgi_index index.php;
          include fastcgi_params;
          fastcgi_cache MYAPP;
          fastcgi_cache_valid 200 60m;
      }
  }
  </code></pre>
  
  <p><strong>nginx.conf</strong></p>
  
  <pre><code>user www-data;
  worker_processes 4;
  pid /var/run/nginx.pid;
  
  events {
      worker_connections 768;
      # multi_accept on;
  }
  
  http {
  
      sendfile on;
      tcp_nopush on;
      tcp_nodelay on;
      keepalive_timeout 65;
      types_hash_max_size 2048;
      # server_tokens off;
  
  
      include /etc/nginx/mime.types;
      default_type application/octet-stream;
  
      access_log /var/log/nginx/access.log;
      error_log /var/log/nginx/error.log;
  
      gzip on;
      gzip_disable "msie6";
  
      include /etc/nginx/conf.d/*.conf;
      include /etc/nginx/sites-enabled/*;
  }
  </code></pre>