title: Nginx does not return 304 for "if-modified-since" header
body: <p>I have a server running nginx that serves a web application built with ratpack and I can not manage to get the 304 response from when requesting the website from a browser or with curl.</p>
  
  <p>Nginx conf: </p>
  
  <pre><code>location / {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-NginX-Proxy true;
      proxy_read_timeout 240;
      proxy_pass http://example.com/;
      proxy_redirect off;
      add_header Last-modified "Wed, 29 Nov 2017 12:56:25";
      if_modified_since   before;
  }
  </code></pre>
  
  <p>From the browser I always get 200 ok and with curl i get</p>
  
  <pre><code>HTTP/1.1 302 Found
  Server: nginx/1.6.3
  Date: Wed, 29 Nov 2017 14:23:07 GMT
  Content-Length: 0
  Connection: keep-alive
  location: http://example.com/display
  Last-Modified: Wed, 29 Nov 2017 12:56:25
  </code></pre>
  
  <p>I have tried this two curl commands and both give the above response:</p>
  
  <pre><code>curl -I -H "If-Modified-Since: Wed,  29 Nov 2017 14:27:08" -X GET 
  https://example.com
  
  curl -I -H "If-Modified-Since: Wed,  29 Nov 2017 14:27:08" 
  https://example.com
  </code></pre>
  
  <p>Why am I getting 302 with curl and 200 ok in the browser?
  What am I doing wrong? I can see that the browser is making its request with the "If-Modified-Since" header. When I reload the page resources are loaded from the browser cache, and with a hard reload all resources get a 200 ok. </p>