You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Reindl Harald <h....@thelounge.net> on 2012/07/15 21:12:33 UTC

caching of javascript/css

hi

i am new at apache trafficserver and very impressed how easy it was to
get  version 3.2 working with some dnsmasq/scripting-tricks to generate
a config for any vhost from any backendserver leaving the control
to DNS if it will be served via reverse-proxy or directly

we are limiting age to 60 seconds controlled by mod_exipres/mod_headers
on backend httpd to make sure that changed contents refreshed to users
while within the 60 secods images are served much faster as with httpd
and reduce the needed httpd-prefrok processes
_____________________

only one thing hurts me:

CONFIG proxy.config.http.cache.cache_responses_to_cookies INT 3
3 - cache for all but text content-types

this is virtually perfect to get dynamic php pages not cached
but it will also disable caching of js/css and these days there
are often a lot of these types included in a website and at high
load saying from 1000 users loading 10 javascripts it is not
optimal

is there any way to force trafficserver caching text/css and
text/javascript even if the client sends cookies to it what
happens all the time if there exists a php-session for the
website?

thank you for any hint and this great software!







Re: caching of javascript/css

Posted by Reindl Harald <h....@thelounge.net>.
this works fine if somebody needs the same

url_regex=. suffix=css ttl-in-cache=60 cache-responses-to-cookies=1
url_regex=. suffix=js ttl-in-cache=60 cache-responses-to-cookies=1

Am 16.07.2012 14:03, schrieb Reindl Harald:
> the idea is damned good
> but i am not really a regexp expert
> 
> all of the 3 below are resulting in a request on the origin-server
> by click "reload" in the browser having open a css-file
> 
> # cache.config
> url_regex=* suffix=css revalidate=60 ttl-in-cache=60 cache-responses-to-cookies=1
> url_regex=* suffix=js revalidate=60 ttl-in-cache=60 cache-responses-to-cookies=1
> 
> # cache.config
> url_regex=*. suffix=css revalidate=60 ttl-in-cache=60 cache-responses-to-cookies=1
> url_regex=*. suffix=js revalidate=60 ttl-in-cache=60 cache-responses-to-cookies=1
> 
> # cache.config
> url_regex=*.css revalidate=60 ttl-in-cache=60 cache-responses-to-cookies=1
> url_regex=*.js revalidate=60 ttl-in-cache=60 cache-responses-to-cookies=1
> 
> thanks for any hint
> 
> Am 16.07.2012 05:48, schrieb Alan M. Carroll:
>> I would recommend looking at the cache.config file in etc/trafficserver. You can use a regex to match URLs (such as all .js files) and specifically override the cache_response_to_cookies values for matching URLs.
>>
>> Sunday, July 15, 2012, 2:12:33 PM, you wrote:
>>
>>
>>> only one thing hurts me:
>>
>>> CONFIG proxy.config.http.cache.cache_responses_to_cookies INT 3
>>> 3 - cache for all but text content-types
>>> is there any way to force trafficserver caching text/css and
>>> text/javascript even if the client sends cookies to it what
>>> happens all the time if there exists a php-session for the
>>> website?
>>
>>> thank you for any hint and this great software!
>>
>>
>>
>>
>>
>>
>>
> 

-- 

Reindl Harald
the lounge interactive design GmbH
A-1060 Vienna, Hofmühlgasse 17
CTO / CISO / Software-Development
p: +43 (1) 595 3999 33, m: +43 (676) 40 221 40
icq: 154546673, http://www.thelounge.net/

http://www.thelounge.net/signature.asc.what.htm




Re: caching of javascript/css

Posted by Reindl Harald <h....@thelounge.net>.
the idea is damned good
but i am not really a regexp expert

all of the 3 below are resulting in a request on the origin-server
by click "reload" in the browser having open a css-file

# cache.config
url_regex=* suffix=css revalidate=60 ttl-in-cache=60 cache-responses-to-cookies=1
url_regex=* suffix=js revalidate=60 ttl-in-cache=60 cache-responses-to-cookies=1

# cache.config
url_regex=*. suffix=css revalidate=60 ttl-in-cache=60 cache-responses-to-cookies=1
url_regex=*. suffix=js revalidate=60 ttl-in-cache=60 cache-responses-to-cookies=1

# cache.config
url_regex=*.css revalidate=60 ttl-in-cache=60 cache-responses-to-cookies=1
url_regex=*.js revalidate=60 ttl-in-cache=60 cache-responses-to-cookies=1

thanks for any hint

Am 16.07.2012 05:48, schrieb Alan M. Carroll:
> I would recommend looking at the cache.config file in etc/trafficserver. You can use a regex to match URLs (such as all .js files) and specifically override the cache_response_to_cookies values for matching URLs.
> 
> Sunday, July 15, 2012, 2:12:33 PM, you wrote:
> 
> 
>> only one thing hurts me:
> 
>> CONFIG proxy.config.http.cache.cache_responses_to_cookies INT 3
>> 3 - cache for all but text content-types
>> is there any way to force trafficserver caching text/css and
>> text/javascript even if the client sends cookies to it what
>> happens all the time if there exists a php-session for the
>> website?
> 
>> thank you for any hint and this great software!
> 
> 
> 
> 
> 
> 
> 

-- 

Reindl Harald
the lounge interactive design GmbH
A-1060 Vienna, Hofmühlgasse 17
CTO / CISO / Software-Development
p: +43 (1) 595 3999 33, m: +43 (676) 40 221 40
icq: 154546673, http://www.thelounge.net/

http://www.thelounge.net/signature.asc.what.htm




Re: caching of javascript/css

Posted by "Alan M. Carroll" <am...@network-geographics.com>.
I would recommend looking at the cache.config file in etc/trafficserver. You can use a regex to match URLs (such as all .js files) and specifically override the cache_response_to_cookies values for matching URLs.

Sunday, July 15, 2012, 2:12:33 PM, you wrote:


> only one thing hurts me:

> CONFIG proxy.config.http.cache.cache_responses_to_cookies INT 3
> 3 - cache for all but text content-types
> is there any way to force trafficserver caching text/css and
> text/javascript even if the client sends cookies to it what
> happens all the time if there exists a php-session for the
> website?

> thank you for any hint and this great software!