title: Nginx proxy cache working for curl, but not browsers
body: <p>I have configured Nginx caching, working primarily off of <a href="https://www.nginx.com/blog/nginx-caching-guide/" rel="nofollow">Nginx's own documentation</a>. When I call a URL that should be cached using <code>curl</code>, it works exactly as expected: a <code>MISS</code> on first request, and a <code>HIT</code> on all subsequent requests. However, when I call that same URL in any major browser, I get a <code>MISS</code> every time - even if that same URL has just been called by <code>curl</code> and is cached.</p>
  
  <p>Here is my Nginx config:</p>
  
  <pre><code>proxy_cache_path /tmp/nginx levels=1:2 keys_zone=lb_cache:10m inactive=60m use_temp_path=off;
  proxy_cache_key "$request_method$host$request_uri";
  
  proxy_cache_lock on; 
  proxy_cache_use_stale updating;
  
  server {
      location / {
          proxy_cache lb_cache;
  
          proxy_ignore_headers Expires;
          proxy_hide_header Expires;
  
          proxy_cache_valid 200 60m; 
          proxy_cache_revalidate on; 
  
          proxy_no_cache $no_cache;
          proxy_cache_bypass $http_cache_control $http_pragma $cookie_nocache $arg_nocache;
  
          add_header X-Cache-Status $upstream_cache_status;
  
          proxy_pass http://webservers;
  
          if ($request_uri ~* "/(admin/)") {
              set $no_cache true;
          }   
          if ($http_cookie ~* "SESS") {
              set $no_cache true;
          }
      }
  }
  </code></pre>
  
  <p>How can I ensure that my cache is consistently being used, and what is it about the browsers that's different from curl when making the request that causes my cache to miss?</p>