Forum Discussion
Bruce_Walker_11
Nimbostratus
Jun 21, 2010iRule for taking part of an original URI and inserting to a new URL
Hi there,
Was wondering what an iRule would look like that does the following:
Original URL:
Required URL: http://www.environment.domain/globalSearch?q=someuritocopy ...
hoolio
Cirrostratus
Jun 23, 2010Hi Bruce,
The values for most HTTP:: commands are cached in the same event of the same priority. To log the updated value, you can add a second HTTP_REQUEST event which runs after the default priority of 500:
when HTTP_REQUEST {
Check if some condition is true?
if { [string tolower [HTTP::host]] eq "search.devint.lpo" and [HTTP::path] eq "/listing" and [HTTP::query] contains "Ntt"} {
Log the original Host and URI request
log local0. "Original Client Request is: [HTTP::header value host][HTTP::uri]"
Rewrite the URI with the original path and the query string replaced
with just the Ntt parameter value set for the q parameter
HTTP::uri "/globalSearch?q=[URI::query "?&[HTTP::query] &Ntt"]"
Update the host header
HTTP::header replace Host "www.devint.lpo"
}
}
when HTTP_REQUEST priority 501 {
Log the modified Host and URI
log local0. "(501) Modified Client Request is: [HTTP::header value Host][HTTP::uri]"
}
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