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

    Squid no cache dynamic images

    Scheduled Pinned Locked Moved Cache/Proxy
    5 Posts 3 Posters 4.5k 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.
    • T
      tquang
      last edited by

      Dear friends,

      I have been installed Squid and everything is OK, but I can not config to Squid cache dynamic images. I have a link

      http://1.bp.blogspot.com/-Tlasd9BJ_DU/TqT4yheFfwI/AAAAAAAADuk/pIeUBKm5T34/Chapter%25252520003-004.jpg?imgmax=0
      

      I configurated locate cache with custom refresh_patterns

      #Images
      refresh_pattern -i \.(gif|png|jpeg|jpg|bmp|tif|tiff|ico)(?\.*|$) 259200 100% 259200 override-expire override-lastmod reload-into-ims ignore-reload ignore-no-cache ignore-private;
      

      It doesn't work
      _first time (from client)

      tquang$ curl -I http://1.bp.blogspot.com/-Tlasd9BJ_DU/TqT4yheFfwI/AAAAAAAADuk/pIeUBKm5T34/Chapter%25252520003-004.jpg?imgmax=0
      HTTP/1.1 200 OK
      Access-Control-Allow-Origin: *
      ETag: "vee9"
      Expires: Sun, 13 Sep 2015 03:43:32 GMT
      Content-Disposition: inline;filename="Chapter 003-004.jpg"
      Content-Type: image/jpeg
      X-Content-Type-Options: nosniff
      Date: Sat, 12 Sep 2015 08:54:30 GMT
      Server: fife
      Content-Length: 446981
      X-XSS-Protection: 1; mode=block
      Cache-Control: public, max-age=86400, no-transform
      Age: 0
      X-Cache: MISS from localhost
      X-Cache-Lookup: MISS from localhost:3128

      Connection: keep-alive

      _second time (from client)

      tquang$ curl -I http://1.bp.blogspot.com/-Tlasd9BJ_DU/TqT4yheFfwI/AAAAAAAADuk/pIeUBKm5T34/Chapter%25252520003-004.jpg?imgmax=0
      HTTP/1.1 200 OK
      Access-Control-Allow-Origin: *
      ETag: "vee9"
      Expires: Sun, 13 Sep 2015 03:39:51 GMT
      Content-Disposition: inline;filename="Chapter 003-004.jpg"
      Content-Type: image/jpeg
      X-Content-Type-Options: nosniff
      Date: Sat, 12 Sep 2015 08:59:58 GMT
      Server: fife
      Content-Length: 446981
      X-XSS-Protection: 1; mode=block
      Cache-Control: public, max-age=86400, no-transform
      Age: 0
      X-Cache: MISS from localhost
      X-Cache-Lookup: MISS from localhost:3128

      Connection: keep-alive

      And here log from server (pfSense + Squid)

      1442048487.677    109 10.10.10.56 TCP_MISS/200 488 HEAD http://1.bp.blogspot.com/-Tlasd9BJ_DU/TqT4yheFfwI/AAAAAAAADuk/pIeUBKm5T34/Chapter%25252520003-004.jpg?imgmax=0 - ORIGINAL_DST/216.58.221.129 image/jpeg
      1442048488.747    72 10.10.10.56 TCP_MISS/200 488 HEAD http://1.bp.blogspot.com/-Tlasd9BJ_DU/TqT4yheFfwI/AAAAAAAADuk/pIeUBKm5T34/Chapter%25252520003-004.jpg?imgmax=0 - ORIGINAL_DST/216.58.221.129 image/jpeg

      So, please help me; how to config rule of Squid to it can work?

      Thanks!

      1 Reply Last reply Reply Quote 0
      • E
        earthtorob
        last edited by

        I get TCP_Miss on just about everything.  On my best day LightSquid reports that it caches about 5%

        1 Reply Last reply Reply Quote 0
        • A
          aGeekhere
          last edited by

          Lets take 2 better examples

          Two car images

          http://media.caranddriver.com/images/media/51/dissected-lotus-based-infiniti-emerg-e-sports-car-concept-top-image-photo-451994-s-original.jpg

          https://images.omkt.co/Files/402/15EAC0/19F78/8c2112737cfe4cd88779712a4906ef6d/0/hero_forte_2014–kia-1920x.png

          The first will cache.

          The second will not for me.

          Never Fear, A Geek is Here!

          1 Reply Last reply Reply Quote 0
          • T
            tquang
            last edited by

            Ok guys, after removed Squid3 and reinstall Squid3 (build 0.4.1.1), I did work fine.

            Services > Squid Proxy Server > General
            X-Forwarded Header Mode: transparent
            Disable VIA Header: checked
            URI Whitespace Characters Handling: strip
            Suppress Squid Version: checked

            Services > Squid Proxy Server > Local Cache
            Memory Cache Size: 128
            Maximum Object Size in RAM: 256
            Cache Dynamic Content: check
            Custom refresh_patterns: view below

            ########### Refresh_pattern Config:
            refresh_pattern ^ftp: 1440 20% 10080 reload-into-ims
            refresh_pattern ^gopher: 1440 0% 1440
            
            #Images
            refresh_pattern -i \.(gif|png|jpeg|jpg|bmp|tif|tiff|ico)(\?.*|$) 10080 50% 43200 override-expire override-lastmod reload-into-ims ignore-reload ignore-no-cache ignore-auth ignore-private
            
            #Website
            refresh_pattern -i \.(xml|js|jsp|txt|css)(\?.*|$) 10080 50% 43200 override-expire override-lastmod reload-into-ims ignore-reload ignore-no-cache ignore-auth override-lastmod reload-into-ims ignore-private
            
            #Media
            refresh_pattern -i \.(flv|x-flv|mov|avi|qt|mpg|mpeg|swf|wmv)(\?.*|$) 10080 50% 43200 override-expire override-lastmod reload-into-ims ignore-reload ignore-no-cache override-lastmod reload-into-ims ignore-private
            refresh_pattern -i \.(wav|mp3|mp4|au|mid)(\?.*|$) 10080 50% 43200 override-expire override-lastmod reload-into-ims ignore-reload ignore-no-cache ignore-auth ignore-private
            
            #Files
            refresh_pattern -i \.(iso|deb|rpm|zip|tar|tgz|ram|rar|bin|ppt|doc)(\?.*|$) 10080 90% 43200 ignore-no-cache ignore-auth override-lastmod reload-into-ims ignore-private
            refresh_pattern -i \.(zip|gz|arj|lha|lzh)(\?.*|$) 10080 100% 43200 override-expire ignore-no-cache ignore-auth override-lastmod reload-into-ims ignore-private
            refresh_pattern -i \.(rar|tgz|tar|exe|bin)(\?.*|$) 10080 100% 43200 override-expire ignore-no-cache ignore-auth ignore-reload ignore-no-cache override-lastmod reload-into-ims ignore-private
            refresh_pattern -i \.(hqx|pdf|rtf|doc|swf)(\?.*|$) 10080 100% 43200 override-expire ignore-no-cache ignore-auth override-lastmod reload-into-ims ignore-private
            refresh_pattern -i \.(inc|cab|ad|txt|dll)(\?.*|$) 10080 100% 43200 override-expire ignore-no-cache ignore-auth override-lastmod reload-into-ims ignore-private
            
            refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
            refresh_pattern . 1440 90% 10080
            

            And here result

            First time:

            Phungs-MBP:~ tquang$ curl -I  http://1.bp.blogspot.com/-Tlasd9BJ_DU/TqT4yheFfwI/AAAAAAAADuk/pIeUBKm5T34/Chapter%25252520003-004.jpg?imgmax=0
            HTTP/1.1 200 OK
            Access-Control-Allow-Origin: *
            ETag: "v2705b"
            Expires: Mon, 26 Oct 2015 02:19:56 GMT
            Content-Disposition: inline;filename="2.jpg"
            Content-Type: image/jpeg
            X-Content-Type-Options: nosniff
            Date: Sun, 25 Oct 2015 07:50:46 GMT
            Server: fife
            Content-Length: 688205
            X-XSS-Protection: 1; mode=block
            Age: 1670
            Cache-Control: public, max-age=86400, no-transform
            X-Cache: MISS from localhost
            X-Cache-Lookup: MISS from localhost:3128

            Connection: keep-alive

            Second time:

            Phungs-MBP:~ tquang$ curl -I  http://1.bp.blogspot.com/-Tlasd9BJ_DU/TqT4yheFfwI/AAAAAAAADuk/pIeUBKm5T34/Chapter%25252520003-004.jpg?imgmax=0
            HTTP/1.1 200 OK
            Access-Control-Allow-Origin: *
            ETag: "v2705b"
            Expires: Mon, 26 Oct 2015 02:19:56 GMT
            Content-Disposition: inline;filename="2.jpg"
            Content-Type: image/jpeg
            X-Content-Type-Options: nosniff
            Date: Sun, 25 Oct 2015 07:50:46 GMT
            Server: fife
            Content-Length: 688205
            X-XSS-Protection: 1; mode=block
            Cache-Control: public, max-age=86400, no-transform
            Age: 1702
            X-Cache: HIT from localhost
            X-Cache-Lookup: HIT from localhost:3128

            Connection: keep-alive

            Ich hoffe die Artikel euch hiften werden!

            1 Reply Last reply Reply Quote 0
            • T
              tquang
              last edited by

              @aGeekHere:

              Lets take 2 better examples

              Two car images

              http://media.caranddriver.com/images/media/51/dissected-lotus-based-infiniti-emerg-e-sports-car-concept-top-image-photo-451994-s-original.jpg

              https://images.omkt.co/Files/402/15EAC0/19F78/8c2112737cfe4cd88779712a4906ef6d/0/hero_forte_2014–kia-1920x.png

              The first will cache.

              The second will not for me.

              Because the second link has header name: P3P. So I have no ideal for this, I'm searching for this case. May be Squid doesn't effect to P3P header

              Phungs-MBP:~ tquang$ curl -I https://images.omkt.co/Files/402/15EAC0/19F78/8c2112737cfe4cd88779712a4906ef6d/0/hero_forte_2014–kia-1920x.png
              HTTP/1.1 200 OK
              Content-Length: 2692395
              Content-Type: image/png
              Last-Modified: Thu, 05 Mar 2015 16:01:38 GMT
              Accept-Ranges: bytes
              ETag: "0dd6fa95d57d01:0"
              X-Frame-Options: SAMEORIGIN
              P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTR STP IND DEM"
              ServerID: 1435
              X-FRAME-OPTIONS: SAMEORIGIN
              Date: Sun, 25 Oct 2015 08:22:00 GMT

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