Forum Discussion
johns
Employee
Mar 02, 2006iRule recognize blank space in URI?
Hi, I need to detect blank space in URI and either remove it or rewrite it:
www.mysite.com/some content/showme.html
to
www.mysite.com/some%20content/showme.html
...
johns
Employee
Mar 24, 2006The rule is:
when CLIENT_ACCEPTED {
TCP::collect 60
}
when CLIENT_DATA {
set matchedURI [regexp -inline "/vMoD.+HTTP" [TCP::payload]]
log local0. "first match $matchedURI"
if { [string length $matchedURI] > 0 } {
set newURI [getfield [getfield $matchedURI " HTTP" 1] "\{" 2]
log local0. "URI was matched. Result: $newURI"
set uriRewrite 1
} else {
log local0. "no match"
set uriRewrite 0
}
}
when HTTP_REQUEST {
if {$uriRewrite == 1} {
log local0. "Encoding $newURI"
regsub -all " " $newURI %20 encURI
set encURI [string map { " " %20} $newURI]
HTTP::uri $encURI
log local0. "It worked! [HTTP::uri]"
}
}
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
