title: nginx cache reverse proxy not caching
body: <p>I have the following and it is not working, as my requests are not cached. Could you please identify what is wrong?</p>
  
  <pre><code>http {
          proxy_cache_path  /mint/cache  levels=1:2    keys_zone=STATIC2:10m       inactive=24h  max_size=1g;
   server {
                  listen 443 ssl;
                  server_name cached-calls.domain.com;
                  location /spaces {
                          index index.html index.htm;
                          charset utf-8;
                          proxy_pass https://preview.contentful.com/spaces;
                          proxy_ignore_headers Set-Cookie Cache-Control Expires;
                          proxy_hide_header "Set-Cookie";
                          proxy_cache STATIC2;
                          proxy_cache_min_uses 1;
                          proxy_cache_methods GET;
                          proxy_cache_key $host$uri$is_args$args;
                          proxy_cache_valid 200 201 202 203 204 205 206 207 208 226 300 301 302 303 304  305 10m;
                          proxy_cache_use_stale   error timeout invalid_header updating http_500 http_502 http_503 http_504;
                          proxy_redirect off;
                          proxy_set_header X-Forwarded-Host $host;
                          proxy_set_header X-Forwarded-Server $host;
                          proxy_set_header X-Real-IP $remote_addr;
                          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_For;
                          proxy_set_header Connection "";
                          proxy_http_version 1.1;
  
                          proxy_connect_timeout 90s;
                          proxy_send_timeout 90s;
                          proxy_read_timeout 90s;
                          proxy_buffer_size 4k;
                          proxy_buffers 4 32k;
                          proxy_busy_buffers_size 64k;
                          proxy_temp_file_write_size 64k;
                          send_timeout 90s;
  
                  }
          }
  }
  </code></pre>
  
  <p>My Request is:</p>
  
  <pre><code>GET /spaces/&amp;content_type=login&amp;locale=en HTTP/1.1
  Host: localhost:4201
  Connection: keep-alive
  Accept: application/json, text/plain, */*
  X-XSRF-TOKEN: 831a018f-7919-4db5-a97c-778a9f6c088e
  User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
  Referer: http://localhost:4201/en
  Accept-Encoding: gzip, deflate, br
  Accept-Language: en-US,en;q=0.8
  Cookie: XSRF-TOKEN=831a018f-7919-4db5-a97c-778a9f6c088e; JSESSIONID=ECED92B3149D422AA6E26182498F2149; _gat=1; _ga=GA1.1.653346684.1497870993; _gid=GA1.1.720272175.1504510558
  If-None-Match: W/"70fb2193558c29d410dd966b398d5357"
  </code></pre>
  
  <p>Response:</p>
  
  <pre><code>HTTP/1.1 304 Not Modified
  X-Powered-By: Express
  access-control-allow-origin: *
  server: nginx/1.10.2
  date: Tue, 05 Sep 2017 06:57:40 GMT
  connection: close
  access-control-allow-headers: Accept,Accept-Language,Authorization,Cache-Control,Content-Length,Content-Range,Content-Type,DNT,Destination,Expires,If-Match,If-Modified-Since,If-None-Match,Keep-Alive,Last-Modified,Origin,Pragma,Range,User-Agent,X-Http-Method-Override,X-Mx-ReqToken,X-Requested-With,X-Contentful-Version,X-Contentful-Content-Type,X-Contentful-Organization,X-Contentful-Skip-Transformation,X-Contentful-User-Agent,X-Contentful-Enable-Experimental-Feature
  access-control-allow-methods: GET,HEAD,OPTIONS
  access-control-expose-headers: Etag
  access-control-max-age: 1728000
  cf-cache-name: content_delivery
  cf-organization-id: 123456
  cf-space-id: 456789
  etag: W/"987654"
  x-content-type-options: nosniff
  x-contentful-request-id: 123456
  </code></pre>
  
  <p>This is proxied from localhost to cached-calls.domain.com using angular's proxy with this configuration:</p>
  
  <pre><code>  "/spaces" : {
      "target" : "https://cached-calls.domain.com",
      "secure": false,
      "changeOrigin": true,
      "pathRewrite": {
        "^/spaces/": "/spaces/spaceId/entries?access_token=accessToken"
      }
    }
  </code></pre>