Forum Discussion
ssievers_87378
Nimbostratus
Oct 29, 2012Log length of css file in response
Hi,
I have a problem in the following case:
On a website there is a css-file that sometimes is not completely transferred to the client in the response. Now I like to write an iRule, that logs the length of this file when it is transferred to the client in server response, but I do not really know how to get _only_ information about this file in HTTP_RESPONSE event.
The request is a GET for /a/b/main.css
Regards,
Sören
6 Replies
- What_Lies_Bene1
Cirrostratus
You can set a variable on the request, only when you see this URL and then you should be able to read the value of the HTTP Content-Length header in any response, only if the variable has been set. Does that make sense?
- What_Lies_Bene1
Cirrostratus
I'm sure nitass will jump in with an example any minute now... =] - ssievers_87378
Nimbostratus
Hi,
- nitass
Employee
can you try something like this?when HTTP_REQUEST { set uri [HTTP::uri] } when HTTP_RESPONSE { if { $uri equals "/a/b/main.css" } { log local0. "CSS-DEBUG: Content-Length is [HTTP::header Content-Length]" } }
- ssievers_87378
Nimbostratus
Hi,
thanks - It works. I never thought that it can be so easy :-)
Regards,
Sören
- hoolio
Cirrostratus
A tweak to avoid saving the URI for every request:when HTTP_REQUEST { if { [HTTP::uri] equals "/a/b/main.css" } { set log_cl 1 } else { set log_cl 0 } } when HTTP_RESPONSE { if {$log_cl}{ log local0. "CSS-DEBUG: Content-Length is [HTTP::header Content-Length]" } }
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