I get this on my settings page now.
How can I set the headers correctly?
Adv CSS/JS Agg - Cache-Control The cache-control's max-age header being sent by your web server is not at least 1 year in the future.
The web servers configuration should be adjusted only for AdvAgg files. Was looking that the max-age second counter is over 31,536,000 (1 year), actually got NULL.
Warning
Adv CSS/JS Agg - Expires The expires header being sent by your web server is not at least 1 year in the future.
The web servers configuration should be adjusted only for AdvAgg files. Was looking for a second counter over 31,536,000 (1 year), actually got NULL.
Comments
Comment #1
mikeytown2 commentedIf your using Apache, add this to your .htaccess file at the webroot level.
Comment #2
socialnicheguru commenteddoes this go in the .htaccess file in
# Rules to correctly serve gzip compressed CSS and JS files.
# Requires both mod_rewrite and mod_headers to be enabled.
Comment #3
mikeytown2 commentedReference for those comment lines inside of core's .htacces file: http://drupalcode.org/project/drupal.git/blob/refs/heads/7.x:/.htaccess#...
I would put it at the very bottom of the .htaccess file; after the last
</IfModule>. Note that if you have .htaccess turned on, the code in #1 will most likely not make a difference as the .htaccess file inside of the advagg_css & advagg_js files directory should already be applied.If your .htaccess directives have been moved into the httpd.conf file then You need to put the code in #1 in there. Restart of apache will be required.
If your using the import method inside of httpd.conf, then putting the code in #1 inside of core's .htaccess file should work. Restart of apache will be required.
Notes:
https://drupal.org/node/43788
https://groups.drupal.org/node/22864
#2088563-6: Yslow gives: Grade F on Add Expires headers
Comment #4
mikeytown2 commentedFollowing patch has been applied. Adds documentation to the readme file
Comment #6
bzitzow commentedIn attempting to resolve these same warnings I found the following issue:
a) https://www.drupal.org/node/2193333#comment-8469991
b) I also reviewed the updated README.txt (from this issue) and updated the .htaccess per the README.txt
I then deployed the code to pantheon, cleared the cache, and the warnings are still being logged.
(See attached screenshot)
Comment #7
mikeytown2 commented@bzitzow
Looks like something else is setting it to 1 week (604800 seconds). Can you find that value (604800) in your configuration anywhere?
Also open a new issue under the support request category. I've re-closed this one.
Comment #8
SoportePRO commentedWhen using Windows Server, IIS... you need to edit your Drupal 7 website root web.config file and add inside section:
This complete eliminate this warning.
I hope this help someone.
Comment #9
osopolarWhen using apache, make sure that module expires is enabled, for example with
sudo apache2ctl -M |grep expires. If it is not enabled, enable it withsudo a2enmod expires.Should this be documented in README.txt too?
Comment #10
mikeytown2 commented@osopolar
The status report page will check for mod_headers by using the apache_get_modules() function. mod_expires isn't required from my tests but I could have been mistaken.
Comment #11
osopolarI added an follow up issue, as
apache_get_modules()is not available for php as CGI/FastCGI: #2612082: Make clear that for apache mod_headers or mod_expires needs to be enabled.Comment #12
mikeytown2 commentedPutting this issue back to fixed. Will followup on the following issue.
Comment #14
Rob T commentedMike's .htaccess snippet for Apache in #1 worked like a charm. Thanks.
Comment #15
mikeytown2 commentedThe readme has an always up to date root level .htaccess rules: http://cgit.drupalcode.org/advagg/tree/README.txt#n556
Comment #16
numerabilis commentedWhat about Nginx? What should I put in conf file?
Comment #17
mikeytown2 commentedSee the readme
http://cgit.drupalcode.org/advagg/tree/README.txt#n720
Comment #18
uniweb commented#1 works perfectly for me, thanks a lot !