drupal-with-nginx icon indicating copy to clipboard operation
drupal-with-nginx copied to clipboard

Adv CSS/JS Agg Issue

Open kybarg opened this issue 9 years ago • 3 comments
trafficstars

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;
    }

kybarg avatar Jul 26 '16 16:07 kybarg

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

iryston avatar Aug 03 '16 07:08 iryston

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

mustanggb avatar Dec 22 '16 12:12 mustanggb

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

tdm4 avatar Nov 20 '17 11:11 tdm4