Activating mod_expire not working as expected

rudtek

Active Member
Jul 19, 2017
26
2
53
Oregon
cPanel Access Level
Root Administrator
I am trying to turn on my expire headers. I'm running a CENTOS 6.10 kvm with whm v70.0.62.

In easy appache 4 i installed the mod_expire 2.4.37-1.1.2.cpanel.

Then in my .htaccess I put this script:

# Optimize cache-control
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType text/html "access plus 3 days"
ExpiresByType text/xml "access plus 1 seconds"
ExpiresByType text/plain "access plus 1 seconds"
ExpiresByType application/xml "access plus 1 seconds"
ExpiresByType application/rss+xml "access plus 1 seconds"
ExpiresByType application/json "access plus 1 seconds"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/javascript "access plus 1 week"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType application/x-javascript "access plus 1 week"
ExpiresByType image/x-ico "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType application/pdf "access plus 1 month"
<IfModule mod_headers.c>
Header unset ETag
Header unset Pragma
Header unset Last-Modified
Header append Cache-Control "public, no-transform, must-revalidate"
Header set Last-modified "Wed, 23 Jan 2019 1:10:10 GMT"
</IfModule>
</IfModule>

However when I do a site test on pingdom or gmetrix it's still saying I don't have expireheaders active and so both are downgrading me.
 

NixTree

Well-Known Member
Aug 19, 2010
413
5
143
Gods Own Country
cPanel Access Level
Root Administrator
Twitter
Did you tried restarting apache by stopping and then starting ?

Also why you are still on 70 version ? latest is v76.0.18 . Can you please try upgrading the Cpanel to latest version as well.
 
Last edited by a moderator:
  • Like
Reactions: rudtek

rudtek

Active Member
Jul 19, 2017
26
2
53
Oregon
cPanel Access Level
Root Administrator
Did you tried restarting apache by stopping and then starting ?

Also why you are still on 70 version ? latest is v76.0.18 . Can you please try upgrading the Cpanel to latest version as well.
Thanks for the help! Restarting apache did it. I can't believe I didn't try that first.

As for version. I have my system on LTS updates. I guess I thought it was safer, think its better to move it to general availability releases?
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,300
363
Houston
I'm really happy to see you were able to get your issue resolved @rudtek!! Thanks for following up and letting everyone know how it was resolved.

I guess I thought it was safer, think its better to move it to general availability releases?
You're fine to be on LTS - there are sometimes when you will get fixes first on the RELEASE tier but they are backported in most cases to LTS
 

NixTree

Well-Known Member
Aug 19, 2010
413
5
143
Gods Own Country
cPanel Access Level
Root Administrator
Twitter
Glad that you are able to get it fixed by apache restart. I will always suggest to keep almost all softwares to the latest possible versions as that is one way to keep hackers away.