perusio / drupal-with-nginx

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

Adv CSS/JS Agg Issue #256

Open kybarg opened 8 years ago

kybarg commented 8 years ago

If someone has troubles with Adv CSS/JS Agg and in status report sees

The web servers configuration will need to be adjusted. The server should have responded with a 304, instead a 200 was returned.

So I've adjusted config replacing this in drupal.conf

    ## Advanced Aggregation module CSS
    ## support. http://drupal.org/project/advagg.
    location ^~ /sites/default/files/advagg_css/ {
        expires max;
        add_header ETag '';
        add_header Last-Modified 'Wed, 20 Jan 1988 04:20:42 GMT';
        add_header Accept-Ranges '';

        location ~* /sites/default/files/advagg_css/css[_[:alnum:]]+\.css$ {
            access_log off;
            try_files $uri @drupal;
        }
    }

    ## Advanced Aggregation module JS
    ## support. http://drupal.org/project/advagg.
    location ^~ /sites/default/files/advagg_js/ {
        expires max;
        add_header ETag '';
        add_header Last-Modified 'Wed, 20 Jan 1988 04:20:42 GMT';
        add_header Accept-Ranges '';

        location ~* /sites/default/files/advagg_js/js[_[:alnum:]]+\.js$ {
            access_log off;
            try_files $uri @drupal;
        }
    }

With this as it is suggested in official Advagg docs

    ###
    ### advagg_css and advagg_js support
    ###
    location ~* files/advagg_(?:css|js)/ {
      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;
    }
iryston commented 7 years ago

@kybarg thanks! I think it's because not all sites are configured to store files in /sites/default folder

mustanggb commented 7 years ago

Commenting out add_header Last-Modified 'Wed, 20 Jan 1988 04:20:42 GMT'; worked for me.

tdm4 commented 6 years ago

Can confirm replacing the nginx config with code in comment 1 works. Just commenting out the Last-Modified header didn't.