iRule RAM CACHE odd behaviour
Hi, I am trying to cache and serve some content from the static contents of my .Net app. I have enabled the Cache on the HTTP profile, and applied the following rule to my Virtual Server:-
when HTTP_REQUEST {
set hostname [string tolower [HTTP::host]]
set uriadd [string tolower [HTTP::uri]]
if { [TCP::local_port clientside] == "443" } {
if { $hostname == "someURL.test.co.uk" } {
if { !([class match [IP::remote_addr] equals CUST_IP_Addresses])
and !([class match [IP::remote_addr] equals MIC_IP_Addresses])
and !([class match [IP::remote_addr] equals private_net]) } {
drop
} else {
CACHE::disable
pool CUST-someURL.test.co.uk_443_POOL
}
} else {
if { ( $uriadd ends_with ".js" ) ||
( $uriadd ends_with ".pdf" ) ||
( $uriadd ends_with ".css" ) ||
( $uriadd ends_with ".jpg" ) ||
( $uriadd ends_with ".png" ) ||
( $uriadd ends_with ".gif" ) } {
enable the cache
CACHE::enable
} else {
disable the cache
CACHE::disable
}
mobile site
if { $hostname == "someAURL.test.co.uk" } {
pool CUST-someAURL.test.co.uk_443_POOL
} elseif { ($hostname ends_with "test.co.uk") } {
pool CUST-www.test.co.uk_443_POOL
} elseif { ($hostname ends_with "test1.co.uk") } {
pool CUST-test1.co.uk_443_POOL
} else {
pool CUST-test2.co.uk_443_POOL
}
}
-----------------------------------------------------
Handle HTTP requests
} else {
if { $hostname == "someURL.test.co.uk" } {
if { !([class match [IP::remote_addr] equals CUST_IP_Addresses])
and !([class match [IP::remote_addr] equals MIC_IP_Addresses])
and !([class match [IP::remote_addr] equals private_net]) } {
drop
} else {
CACHE::disable
pool CUST-someURL.test.co.uk_80_POOL
}
} else {
if { ( $uriadd ends_with ".js" ) ||
( $uriadd ends_with ".pdf" ) ||
( $uriadd ends_with ".css" ) ||
( $uriadd ends_with ".jpg" ) ||
( $uriadd ends_with ".png" ) ||
( $uriadd ends_with ".gif" ) } {
enable the cache
CACHE::enable
} else {
disable the cache
CACHE::disable
}
mobile site
if { $hostname == "someAURL.test.co.uk" } {
pool CUST-someAURL.test.co.uk_80_POOL
} elseif { ($hostname ends_with "test.co.uk") } {
pool CUST-www.test.co.uk_80_POOL
} elseif { ($hostname ends_with "test1.co.uk") } {
pool CUST-test1.co.uk_80_POOL
} else {
pool CUST-test2.co.uk_80_POOL
}
}
}
-----------------------------------------------------
Tidy up variables
unset hostname uriadd
}
So i expect all assets that end in js, pdf, css, jpg, png, or gif to be cached and then served from the cache. however when i turn on log these cache hits in the local log, it lists the assets but says 0 cache hits for the identical assets over and over again. : 0 cache hits for document at www.bla.co.uk/Assets/bla/Images-css/btn-close.png : 0 cache hits for document at www.bla.co.uk/Assets/bla/products/H/O/N/HONIPUPB_AV2_st.jpg : 0 cache hits for document at www.bla.co.uk/Assets/bla/Images-css/right-tab-selected.png : 0 cache hits for document at www.bla.co.uk/Assets/bla/Images-css/left-tab-selected.png : 0 cache hits for document at www.bla.co.uk/Assets/bla/Images-css/bg-resultsmenu.png : 0 cache hits for document at www.bla.co.uk/Assets/bla/Images-css/bg-add-to-basket.png : 0 cache hits for document at www.bla.co.uk/Assets/bla/Images/btn-go.png
We have pretty much exactly the same rule running for the site serving the CMS and these are clearly showing cache hits of more than 0. if anyone can explain what is happening that would be great. we use 10.2.3, and dont have webaccelerator. Many thanks