Forum Discussion
Wil_Schultz_101
Nimbostratus
Feb 12, 2007How can I grab an HTTP header on CACHE_REQUEST?
I'm trying to grab [HTTP::header "Content-Length"] to use during CACHE_REQUEST so I can make sure the BigIP does not cache blank pages. I've tried to set a global variable during HTTP::Response and no go. The closest I can seem to find would be to use [CACHE::headers] during CACHE_REQUEST.
What I'm using now, fugly...
when CACHE_REQUEST {
set cheaders [CACHE::headers]
if { $cheaders contains "Content-Length\: 0" } {
log local0.$cheaders
CACHE::expire
}
}
What I would like to get closer to... Looks okay, but doesn't seem to work.
when CACHE_REQUEST {
set cheaders [HTTP::header "Content-Length"]
if { $cheaders == 0 } {
log local1.$cheaders
CACHE::expire
}
}
Version 9.2.4
- dennypayne
Employee
This rule is in the wiki, so it seems HTTP::header is valid within CACHE_REQUEST (although the wiki does not definitively call this out):when CACHE_REQUEST { if { [HTTP::header "Content-Length"] equals "0" } { CACHE::expire log local.tooshort } }
- bl0ndie_127134Historic F5 AccountUh ... why don't you just set the minimum object size to be a non zero value in the ramcache http profile?
- Wil_Schultz_101
Nimbostratus
Well, there are two reasons... - bl0ndie_127134Historic F5 AccountThe logic for calculating the min size is pretty darn simple. If the minimum size is not working then its a bug. Do you have responses that don't have a content length header (just 'Connection: close')? Can you open a support case so that I can peek at the packet captures for the cases where it does not work?
- Wil_Schultz_101
Nimbostratus
Sorry, here is an example. I have "Minimum Object Size" set to 500 bytes yet I still receive the following page.Profile my_profile | URI /blank.htm | Host www.my.com | 16 hits Size 208 | Received 2007-02-12 14:44:09 Last sent 2007-02-12 14:44:12 | Expires 1969-12-31 16:00:00 Vary none Vary count 1 [root@bigip1:Active] config
http://www.my.com/blank.htm GET /blank.htm HTTP/1.1 Host: www.my.com User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Pragma: no-cache Cache-Control: no-cache HTTP/1.x 200 OK Connection: Keep-Alive Date: Mon, 12 Feb 2007 22:45:55 GMT Age: 106 Content-Length: 6 Server: Apache-Coyote/1.1 Etag: W/"6-1169519270000" Last-Modified: Tue, 23 Jan 2007 02:27:50 GMT Content-Type: text/html
- bl0ndie_127134Historic F5 AccountDo you by any chance have defined an cache uri include that will match '/blank.htm'? The URI includes take precedence over all the configuration and will force the document to get cached regardless of the mix/max water marks. Otherwise go ahead and open a support case and we will look at it.
- Wil_Schultz_101
Nimbostratus
Posted By bl0ndie on 2/12/2007 2:51 PM - Wil_Schultz_101
Nimbostratus
Posted By bl0ndie on 2/12/2007 2:58 PM - Wil_Schultz_101
Nimbostratus
Ticket is opened: c329237 - Wil_Schultz_101
Nimbostratus
Posted By wschultz on 2/12/2007 3:07 PM
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects