Forum Discussion
s3s1277_111291
Nimbostratus
Apr 02, 2012question on iRule
I've created a simple iRule to match a string in URI, and redirect to different URL. But it is appending extra '/' after the hostname in the URL. Any idea why?
Here is the rule:
if { [HTTP::uri] contains "string1234" } {
log local0. "Matched and redirecting to http://xxxxxx[HTTP::uri]"
HTTP::redirect http://xxxxxx[http::uri]
}
And this is what I see in the ltm log file:
local/tmm info tmm[5076]: Rule testrule : Matched and redirecting to http://xxxxxx//BC/string1234?all
Note the two '//' after hostname xxxxxxx.
Thanks.
4 Replies
Sort By
- Sashi_81625
Nimbostratus
[HTTP::uri] starts with "/" ... if you are adding "/" after host, remove it. - s3s1277_111291
Nimbostratus
But I dont have a / after the host. here is the redirect I'm using: - Michael_Yates
Nimbostratus
Hi s3s1277,when HTTP_REQUEST { if { [HTTP::uri] contains "/string1234" } { log local0. "Matched and redireting to http://xxxxxx[HTTP::uri]" log local0. "HTTP::host Value: [HTTP::host]" log local0. "HTTP::uri Value: [HTTP::uri]" HTTP::redirect "http://xxxxxx[HTTP::uri]" } }
- s3s1277_111291
Nimbostratus
Thank you. I was declaring a variable at the top, for the host (without a /). It somehow appends extra /. Without declaring a variable, if I add the host explicitly in the redirect rule, it is not appending the extra /. Like this..
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