Forum Discussion
Bruce_Walker_11
Jun 23, 2010Nimbostratus
Hi Aaron,
Thanks for the above, but it looks like the URI is not being rewritten. The rule is being matched and the host header is changed, but the URI remains the same as original.
This is the request: (which the output URI should change to
Your modified iRule is below with the logging statements in I am using.
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"
Log the modified Host and URI
log local0. "Modified Client Request is: [HTTP::header value Host][HTTP::uri]"
}
}
LTM Log output:
tmm tmm[1817]: Rule searchrewrite.iRule.devint : Original Client Request is: search.devint.lpo/listing?Ntt=test
tmm tmm[1817]: Rule searchrewrite.iRule.devint : Modified Client Request is: www.devint.lpo/listing?Ntt=test
Any thoughts?
Thanks,
Bruce