2

I have a folder with this file: channel.html

In the same folder I have this .htaccess file

<Files channel.html>
ExpiresActive On
ExpiresDefault A31536000
Header set Cache-Control "max-age=31536000"
</Files>

curl -I /channel.html:

HTTP/1.1 200 OK
Date: Wed, 09 Nov 2011 17:27:30 GMT
Server: Apache
Accept-Ranges: bytes
X-Mod-Pagespeed: 0.9.18.7-900
Cache-Control: max-age=0, no-cache, no-store
Vary: Accept-Encoding
Content-Length: 59
Content-Type: text/html

If I add ForceType text/plain on .htaccess it works as it should, but with the wrong Content-Type, obviously.

What should I do to fix or debug this annoyance?

1
  • ExpiresDefault "access plus 1 year" would be much easier to read than that mess of numbers which does the same thing.
    – Chris S
    Nov 9, 2011 at 18:18

3 Answers 3

0

Since the Expires header is working for text/plain but not for text/html, have you tried adding ExpiresByType text/html "access plus 1 year"? Or, searching the rest of your configuration for an ExpiresByType text/html directive somewhere else, that's overriding your default?

0

You may have something resetting your headers. If this is a script and not straight static content, then your web application may also be setting cache headers.

Also, I see you are using mod_page speed. I know it tries to do some optimizations, perhaps it is setting headers for you too.

I would try this: Header unset Cache-Control in your .htaccess and see if you still get a Cache header. If you do, then you know that the cache header is being injected somewhere else.

By changing the mime/type, it suggests that whatever is setting the header is doing so just for text/html so it does not touch text/plain.

0

Have you enabled headers rewriting ? if you can spot Invalid command 'ExpiresActive', perhaps misspelled or defined by a module not included in the server configuration

in apache2/error.log, then you may want to run sudo a2enmod headers

as recommended in https://stackoverflow.com/questions/8260738/ruby-on-rails-3-1-leverage-browser-caching

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .