Forum Discussion
smiley_dba_1116
Jul 13, 2015Nimbostratus
The Dreaded %20 for space
Does anyone have a idea how to create a iRule that takes into account spaces between words? I have the iRule below and when I enter abc.def.com/en-ca/Teams/Performance Improvement/0700Reports/default.aspx, the browser adds a %20. Example: http://abc.def.com/en-ca/Teams/Performance%20Improvement/0700Reports/default.aspx
when HTTP_REQUEST {
if { ([string tolower [HTTP::host]] contains "abc.def.com") and [HTTP::uri] starts_with "/en-ca/Teams/IT/IM/default.aspx" } {
HTTP::redirect "http://def.ghi.com/IM2/default.aspx"
}
elseif { ([string tolower [HTTP::host]] contains "abc.def.com") and [HTTP::uri] starts_with "/en-ca/Teams/Performance Improvement/0700Reports/default.aspx" } {
HTTP::redirect "http://def.ghi.com/PerformanceMeasures/0700Reports/default.aspx"
}
}
Thoughts?
RGW
- smiley_dba_1116Nimbostratus
Would I need to modify this to be a HTTP_RESPONSE? And if so, would I need to modify the code?
- cjuniorNacreous
Hi,
What about decode uri? See if it helps you:when HTTP_REQUEST { log local0. "Host: [HTTP::host] | URI: [HTTP::uri] | DECODE: [URI::decode [HTTP::uri]]" if { [string tolower [HTTP::host]] contains "abc.def.com" } { switch -glob [URI::decode [HTTP::uri]] { "/en-ca/Teams/IT/IM/default.aspx*" { HTTP::redirect "http://def.ghi.com/IM2/default.aspx" } "/en-ca/Teams/Performance Improvement/0700Reports/default.aspx*" { HTTP::redirect "http://def.ghi.com/PerformanceMeasures/0700Reports/default.aspx" } } } }
Regards.
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