perusio / drupal-with-nginx

Running Drupal using nginx: an idiosyncratically crafted bleeding edge configuration.
854 stars 246 forks source link

Not getting 304 except for front pgae #229

Closed heyyoyo closed 8 years ago

heyyoyo commented 8 years ago

On my website http://new.israelmodernart.com I dont' understand why I don't get a 304 HTML code, the second time for images, css, js. Even if Etag and Expires header tag seem correct.

My files are not under /sites/default/files but under just /files. I'm also using advagg for js and css.

In Drupal report advagg logs:

Adv CSS/JS Agg - If-Modified-Since  The If-Modified-Since (Last-Modified) header is being ignored by your web server.
The web servers configuration will need to be adjusted. The server should have responded with a 304, instead a 200 was returned.
Warning
Adv CSS/JS Agg - If-Modified-Since  The If-Modified-Since (Last-Modified) header is being ignored by your web server.
The web servers configuration will need to be adjusted. The server should have responded with a 304, instead a 200 was returned.
fidelix commented 8 years ago

How did you solve this problem?

bober2000 commented 8 years ago

@heyyoyo How did you solve this problem?

heyyoyo commented 8 years ago

@Fidelix @bober2000 If I remember correctly: This is what I modified:

    location ~* /files/styles/ {
        access_log off;
        expires 1y;
        try_files $uri @drupal;
    }
    location ~* files/advagg_(?:css|js)/ {
      access_log  off;
      gzip_static on;
      access_log  off;
      expires     max;
      add_header  ETag "";
      add_header  Cache-Control "max-age=31449600, no-transform, public";
      try_files   $uri @drupal;
    }
heyyoyo commented 8 years ago

I'm using this code on this website. I got correctly 304 on css/js and on images from imagecache or not. http://israelmodernart.com