Search squid archive

Re: Re: Create acl based on Accept-Language?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26/08/2013 10:42 a.m., Manuel wrote:
I just found out that Squid caches the content properly from the right
cache_peer but once another user request the same URL the content is fetched
always from the first cached copy which is always based on the first
request.

caching != fetching.

Caching will always be done the same with your config regardless of which peer the response is fetched from.
Your ACL exepriments only affact the fetching decision.

The very definition of caching is that second request gets sent the *cached* copy of the first request (this is known as a cache HIT). It is the origin servers responsibility to decide which language the response is written in and setup the HTTP response headers indicating Language as a variant differentiator for the relevant URLs.

  This problems does not seem to happen with another config that I
have where the acl is based on an IP (not based on Accept-Language). In this
other case even when the user request an URL that has already been cached,
because the user matches an specific IP the content is fetched from the
right cache_peer.	

No. When an object is cached and served from cache the cache_peer are not even consulted.
What exactly are you observing happen?



Examples 1 (not working properly):

acl itlanguage req_header Accept-Language ^it

NP: This will only match if Italian language is the first listed option by the client. It will not match if Italian was for example the second most preferred language.

cache_peer 127.0.0.1 parent 81 0 no-query no-digest originserver
name=maincontent
cache_peer_access maincontent allow !itlanguage
cache_peer_access maincontent deny all

cache_peer 127.0.0.1 parent 81 0 no-query no-digest originserver
name=itcontent
cache_peer_access itcontent allow itlanguage
cache_peer_access itcontent deny all

Example 2 (working properly):

cache_peer 127.0.0.1 parent 81 0 no-query no-digest originserver
name=webserver weight=1000 connect-timeout=2
cache_peer 127.0.0.2 parent 81 0 no-query no-digest originserver
name=webserver2 weight=5 connect-timeout=2
acl maindomain dstdomain www.mydomain.com
acl specialuser src 80.80.80.80/32
cache_peer_access webserver allow maindomain !specialuser
cache_peer_access webserver deny all
cache_peer_access webserver2 allow maindomain !specialuser
cache_peer_access webserver2 deny all

cache_peer 127.0.0.3 parent 81 0 no-query no-digest originserver
name=specialserver
cache_peer_access specialserver allow specialuser maindomain
cache_peer_access specialserver deny all


The only differences I can see are:
- ACL is based on an IP rather than in req_header Accept-Language
- In the second case the cache_peer are not only named different but also
have a different IP (127.0.0.1, 127.0.0.2...) while in the first case both
cache_peer have the same address but it are named different (because the
webserver delivers different content based on the Accept-Language).

Also,
- your HTTP responses are lacking all the HTTP feature syntax that specific Language as a factor in response variation.

Amos




[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux