Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Squid cache

    Scheduled Pinned Locked Moved pfSense Packages
    8 Posts 4 Posters 5.4k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      rafael.cardoso
      last edited by

      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 …

      Respect is Everything!

      1 Reply Last reply Reply Quote 0
      • M
        mhab12
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • N
          Nachtfalke
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • R
            rafael.cardoso
            last edited by

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

            Respect is Everything!

            1 Reply Last reply Reply Quote 0
            • N
              Nachtfalke
              last edited by

              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;
              
              
              1 Reply Last reply Reply Quote 0
              • R
                rafael.cardoso
                last edited by

                Ok, for microsoft updates, you have others too?

                Respect is Everything!

                1 Reply Last reply Reply Quote 0
                • ?
                  Guest
                  last edited by

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

                  1 Reply Last reply Reply Quote 0
                  • R
                    rafael.cardoso
                    last edited by

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

                    Respect is Everything!

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.