Squid cache



  • Is there a way to force squid caching of pdf files?

    I have some sites that will open every day and most of them have the pdf files that are accessed, so I realize it does not cache any …



  • As long as you have the max object size set large enough they should be cached.  I find that Windows Updates, PDFs, and most downloads of any kind are cached so long as they fall under the max size and aren't from a 'do not cache' site.



  • Try this in custom options:

    
    refresh_pattern -i /.*\.(pdf) 1440 100% 1440 reload-into-ims override-expire override-lastmode;
    range_offset_limit -1;
    
    

    This will cache every .pdf file for 1440 minutes. The "override-expire" and "overrider-lastmode" will force squid to cache these pdf files even if the header say "no-cache" or something else.

    Instead of ".*" and "." you could use other regular expressions (regex).

    To avoid, that squid is caching files of a page that a user has left, you could use these custom options:

    
    quick_abort_min 0 KB;
    quick_abort_max 0 KB;
    quick_abort_pct 100;
    
    

    For example you are browsing to a page, click on a .pdf file and open it and the abort the download of this file in your browser, squid is still downloading this file. If you do NOT want this, enter the lines above.



  • Thank you, I will make tests and post the results next week



  • I edited the regex in my post above from

    
    .*\.(pdf)
    
    

    to

    
    /.*\.(pdf)
    
    

    Because of a warning in cache.log

    Further I added some options:

    
    override-expire override-lastmod reload-into-ims ignore-reload ignore-no-cache ignore-private;
    
    

    instead of

    
    reload-into-ims override-expire override-lastmode;
    
    


  • Ok, for microsoft updates, you have others too?



  • Please consult the squid documentation, this question has been asked and answered many times by squid users.



  • Okay, thank you for helping Nachtfalke, the settings seem to have worked


Log in to reply