Forum Discussion
lmiestc_26212
Cirrus
Feb 05, 2010Logging HTTP header that is longer than the maximum allowed
Hi Community,
Recently after an upgrade of our Portal I started to see occasional entries in the /var/log/ltm about
HTTP header (32800) exceeded maximum allowed size of 32768 and that it is for the HTTP Profile.
I know that it is just to change the maximum allowed header size for the HTTP Profile but I would like to write an I rule that parses the GET request and if the Headersize exceeds the maximum allowed size it should write the header in /var/log/ltm
As I am not very good on I rules any ideas on how to write this I rule is much appreciated.
//Ed
8 Replies
- hoolio
Cirrostratus
Hi Ed,Based on http://devcentral.f5.com/wiki/default.aspx/iRules/LogHttpHeaders.html when HTTP_REQUEST { Loop through each header by name foreach aHeader [HTTP::header names] { Check if the length of the header value is greater than 32k if {[string length [HTTP::header value $aHeader]] > 32768}{ Log details for the request log local0. "[IP::client_addr]:[TCP::client_port] (UA: [HTTP::header "User-Agent"] -> [HTTP::host][HTTP::uri],\ $aHeader ([string length [HTTP::header value $aHeader]]): [HTTP::header value $aHeader]" } } }
when HTTP_RESPONSE { Loop through each header by name foreach aHeader [HTTP::header names] { Check if the length of the header value is greater than 32k if {[string length [HTTP::header value $aHeader]] > 32768}{ Log details for the response log local0. "[IP::client_addr]:[TCP::client_port]: $aHeader \ ([string length [HTTP::header value $aHeader]]): [HTTP::header value $aHeader]" } } }
- Thanks very much for the quick answer.
- hoolio
Cirrostratus
Just to follow up on this... - spark_86682Historic F5 AccountJust to clarify, although I can see how the error message could be interpreted this way, it is referring to the total size of all HTTP headers, not any one specific header. So if you have a request with 10 headers that are each 4k long, you'd still hit the limit. If this header size limit is exceeded, then we stop parsing the headers, and kill the connection (so HTTP_REQUEST is indeed never triggered in this case).
- Raj_Zucre_Ramir
Nimbostratus
Hi Guys, - hoolio
Cirrostratus
Hi Raj, - Gauthier_Delac1
Nimbostratus
It seems that this message isn't about the size of one single header, but the size of the full request header, including http command ("GET /... HTTP/1.1") and http headers. - hoolio
Cirrostratus
It seems that this message isn't about the size of one single header, but the size of the full request header, including http command ("GET /... HTTP/1.1") and http headers.
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