Forum Discussion
JosephT
Nimbostratus
Oct 24, 2008Help write an irule to check and strip transfer-encoding header
We have a need to inspect all http requests and, if an HTTP request contains a Transfer-Encoding header with a value greater than 64 bytes, then we want to remove the Transfer-Encoding header from the...
hoolio
Cirrostratus
Oct 24, 2008Hi there,
If you add logging you could see in /var/log/ltm that [HTTP::header "Transfer-Encoding"] will return the value of the header. If you want to get the length of the header value you could use string length (Click here). Also, you should be getting a TCL error about an unknown command from this line:
[HTTP::header remove Transfer-Encoding]
The square braces act like backticks in *nix, executing the code within. HTTP::header remove will return 0 or 1 depending on whether it runs successfully. So the braces would be executing 1 which isn't a valid command.
This should work:
when HTTP_REQUEST {
if { [HTTP::header exists "Transfer-Encoding"] && [string length [HTTP::header "Transfer-Encoding"]] > 64 } {
HTTP::header remove Transfer-Encoding
}
}
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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