View Single Post
Old 05-22-2013, 03:44 PM   #425
mariosipad
Guru
mariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watchmariosipad is clearly one to watch
 
Posts: 725
Karma: 10738
Join Date: Nov 2012
Device: iPad & iPhone with Marvin 2 + 3 & Kobo Glo HD
Quote:
Originally Posted by vlad59 View Post
In theory there nothing to add in Apache config if your library is outside your web directory. Thoses lines in fetch.php tell the browser to keep the images 14 days :

Code:
    $expires = 60*60*24*14;
    header("Pragma: public");
    header("Cache-Control: maxage=".$expires);
    header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
For the intrepid people who are like me running Apache and want to try for themselves. I "removed" the code from fetch.php (this code cannot work in Apache afaik) and added the following to the .htaccess file: (do not forget to enable [headers_module] in apache)
Code:
## Cache
<ifModule mod_headers.c>
Header unset Pragma

# remove and disable ETag
Header unset ETag
FileETag None

# remove Last-Modified
Header unset Last-Modified
 
# cache images for 10 days
<FilesMatch "\.(jpg|ico|jpeg|png|gif)$">
  Header set Cache-Control "max-age=864000, public, must-revalidate"
</FilesMatch>
 
# cache epub/opf/pdf docs for 10 days
<FilesMatch "\.(epub|mobi|opf|pdf)$">
  Header set Cache-Control "max-age=864000, public, must-revalidate"
</FilesMatch>
 
# cache html/htm/xml/txt diles for 2 days
<FilesMatch "\.(html|htm|xml|txt|xsl)$">
  Header set Cache-Control "max-age=7200, must-revalidate"
</FilesMatch>

</ifModule>
However it did not really work for me as I have my data outside of my web directory .

I may have to rethink my storage strategy. More required.

Anyone with a brilliant idea to make this work?
mariosipad is offline   Reply With Quote