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 10, 2006With a lot of help, I am down to the rule below. But the URI is coming out with leading "{" from "regexp -inline... "(I think) and I tried using string trimright to the result with "\}" as the character, but still can't remove that last brace. Any ideas?
when CLIENT_ACCEPTED {
TCP::collect 300
}
when CLIENT_DATA {
set matchedURI [regexp -inline /vMoD.+HTTP [TCP::payload]]
log local0. "first match $matchedURI"
if { [string length $matchedURI] > 0 } {
set newURI [getfield $matchedURI " HTTP" 1]
log local0. "URI was matched. Result: $newURI"
set uriRewrite 1
} else {
log local0. "no match"
set uriRewrite 0
}
}
when HTTP_REQUEST {
if {$uriRewrite == 1} {
set encURI [URI::encode $newURI]
HTTP::uri $encURI
log local0. "It worked! $newURI"
}
}
Thanks.
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
