You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Tim Traver <tt...@simplenet.com> on 2014/01/29 23:22:30 UTC
Determining why an image isn't getting cached
Hi all,
I'm relatively new to ATS, but I really like it so far.
I have a setup of a reverse proxy in front of a web server, and although
it is working, it does not seem to be cacheing.
I have set up the verbose via headers, so I can see when I reload a
particular image that it is a cM (cache Miss). The string I get is as
follows : [uScMsSf pSeN:t cCMi p sS]
When I put this through the via explanation tool, I get the following :
Request headers received from client:
simple request (not conditional)
Result of Traffic Server cache lookup for URL:
miss (a cache "MISS")
Response information received from origin server:
served
Result of document write-to-cache:
no cache write performed
Proxy operation result:
served
Error codes (if any):
no error
The image request from my browser is sending the following headers :
1. GET /home_files/img/fr2_1.png HTTP/1.1 Host:
imagestest.scottevest.com Connection: keep-alive Cache-Control:
max-age=0 Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Pragma: no-cache User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X
10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77
Safari/537.36 Accept-Encoding: gzip,deflate,sdch Accept-Language:
en-US,en;q=0.8 Cookie: __qca=P0-2014987142-1390939606024;
__CT_Data=gpv=5&apv_12360_www07=5; WRUID=0;
__utma=71080210.1796512093.1390939606.1390939606.1390954718.2;
__utmc=71080210;
__utmz=71080210.1390939606.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);
__utmv=71080210.|1=l=%2F=1
and I get the following response headers from ATS :
1.
HTTP/1.1 200 OK Date: Wed, 29 Jan 2014 22:15:08 GMT Server:
ATS/4.1.2 Last-Modified: Wed, 02 Oct 2013 22:15:10 GMT ETag:
"14e57-4e7c9670a1780" Accept-Ranges: bytes Content-Length: 85591
X-Powered-By: PleskLin P3P: CP="NOI DEVa TAIa OUR BUS UNI STA"
Content-Type: image/png Age: 26 Connection: keep-alive Via: http/1.1
scotte6 (ApacheTrafficServer/4.1.2 [uScMsSf pSeN:t cCMi p sS])
How do I debug this issue on why it is getting a cache miss? There of
course may be config parameters that may prevent it, but I have this set
up as simply as possible.
Thanks,
Tim
Re: Determining why an image isn't getting cached
Posted by Tim Traver <tt...@simplenet.com>.
Thank you Leif, making those changes made it so that the image was
indeed cached, and subsequent attempts at retrieving them showed a cache
hit instead of miss.
I also learned now that the original settings were only going to cache
objects that returned from the origin server as "cacheable" with those
particular headers. Its probably easier to control what is cached in ATS
then in apache...
Thank you for your response,
Tim
On 1/29/14, 2:35 PM, Leif Hedstrom wrote:
> On Jan 29, 2014, at 3:22 PM, Tim Traver <tt-list@simplenet.com
> <ma...@simplenet.com>> wrote:
>
>> Hi all,
>>
>> 1.
>>
>> HTTP/1.1 200 OK Date: Wed, 29 Jan 2014 22:15:08 GMT Server:
>> ATS/4.1.2 Last-Modified: Wed, 02 Oct 2013 22:15:10 GMT ETag:
>> "14e57-4e7c9670a1780" Accept-Ranges: bytes Content-Length: 85591
>> X-Powered-By: PleskLin P3P: CP="NOI DEVa TAIa OUR BUS UNI STA"
>> Content-Type: image/png Age: 26 Connection: keep-alive Via:
>> http/1.1 scotte6 (ApacheTrafficServer/4.1.2 [uScMsSf pSeN:t cCMi
>> p sS])
>>
>>
>
> Well, assuming you are using default configurations (which requires an
> Expires: or Cache-Control: max-age= … header), the above is not
> cacheable. However, the Age: 26 seems to imply something cached this,
> how do you know this is not cached? The above is cacheable, if you
> have changed records.config to
>
> CONFIG proxy.config.http.cache.required_headers INT 1
>
> (since there is a Last-Modified in the response).
>
>
> To debug, If you send e.g.
>
> curl -D - -o /dev/null -s -H “Cache-Control: only-if-cached”
> http://some_url.com/foo.png
>
>
> then if it’s a cache miss, you’ll get a 504, vs a 200 OK on a cache hit.
>
>
> Next, the request header you show us is designed to bust all caches.
> By default, ATS follows the RFC 2616 protocol, and allows the client
> to do so, but you can disable that by making sure the following
> configuration is set:
>
> CONFIG proxy.config.http.cache.ignore_client_cc_max_age INT 1
>
>
>
> Finally, a problem could be the old issue related to how we handled
> the various accept headers. You could try to set (this works since you
> are using 4.1.2):
>
> CONFIG proxy.config.http.cache.ignore_accept_mismatch INT 2
> CONFIG proxy.config.http.cache.ignore_accept_language_mismatch INT 2
> CONFIG proxy.config.http.cache.ignore_accept_encoding_mismatch INT 2
> CONFIG proxy.config.http.cache.ignore_accept_charset_mismatch INT 2
>
>
> These are safe to set in v4.1.2 and later with a value of “2”, whereas
> a value of “1” can break sites if they intend to Vary: on the
> respective header. The default is off currently, but we plan on making
> them set to “2” in 5.0.0. While we’re at it, make sure this is also
> set (it’s the default);
>
> CONFIG proxy.config.http.normalize_ae_gzip INT 1
>
>
> I hope this helps.
>
> — Leif
>
Re: Determining why an image isn't getting cached
Posted by Leif Hedstrom <zw...@apache.org>.
On Jan 29, 2014, at 3:22 PM, Tim Traver <tt...@simplenet.com> wrote:
> Hi all,
>
> HTTP/1.1 200 OK
> Date: Wed, 29 Jan 2014 22:15:08 GMT
> Server: ATS/4.1.2
> Last-Modified: Wed, 02 Oct 2013 22:15:10 GMT
> ETag: "14e57-4e7c9670a1780"
> Accept-Ranges: bytes
> Content-Length: 85591
> X-Powered-By: PleskLin
> P3P: CP="NOI DEVa TAIa OUR BUS UNI STA"
> Content-Type: image/png
> Age: 26
> Connection: keep-alive
> Via: http/1.1 scotte6 (ApacheTrafficServer/4.1.2 [uScMsSf
> pSeN:t cCMi p sS])
>
>
Well, assuming you are using default configurations (which requires an Expires: or Cache-Control: max-age= … header), the above is not cacheable. However, the Age: 26 seems to imply something cached this, how do you know this is not cached? The above is cacheable, if you have changed records.config to
CONFIG proxy.config.http.cache.required_headers INT 1
(since there is a Last-Modified in the response).
To debug, If you send e.g.
curl -D - -o /dev/null -s -H “Cache-Control: only-if-cached” http://some_url.com/foo.png
then if it’s a cache miss, you’ll get a 504, vs a 200 OK on a cache hit.
Next, the request header you show us is designed to bust all caches. By default, ATS follows the RFC 2616 protocol, and allows the client to do so, but you can disable that by making sure the following configuration is set:
CONFIG proxy.config.http.cache.ignore_client_cc_max_age INT 1
Finally, a problem could be the old issue related to how we handled the various accept headers. You could try to set (this works since you are using 4.1.2):
CONFIG proxy.config.http.cache.ignore_accept_mismatch INT 2
CONFIG proxy.config.http.cache.ignore_accept_language_mismatch INT 2
CONFIG proxy.config.http.cache.ignore_accept_encoding_mismatch INT 2
CONFIG proxy.config.http.cache.ignore_accept_charset_mismatch INT 2
These are safe to set in v4.1.2 and later with a value of “2”, whereas a value of “1” can break sites if they intend to Vary: on the respective header. The default is off currently, but we plan on making them set to “2” in 5.0.0. While we’re at it, make sure this is also set (it’s the default);
CONFIG proxy.config.http.normalize_ae_gzip INT 1
I hope this helps.
— Leif