Forum Discussion
Rewrite and Mask
Hi, I need to hide specific URI path via IRule.
Actual URL: www.abc.com/myApp/index.php
Required: www.abc.com/index.php
I have wrote an iRule but its replaceing and adding "/myApp/" for every "/"
when HTTP_REQUEST {
log local0. "Incoming URI = [HTTP::uri]"
if { [string tolower [HTTP::uri]] equals "/" and ([HTTP::host] eq "abc.com" or [HTTP::host] eq "www.abc.com")} {
set uri [string map -nocase {"/" "/myApp/"} [HTTP::uri]]
log local0. "New URI = $uri"
HTTP::uri $uri
}
}
2 Replies
- nitass
Employee
I have wrote an iRule but its replaceing and adding "/myApp/" for every "/"
i understand only request to root (/) matches the irule condition ([string tolower [HTTP::uri]] equals "/"), doesn't it?
so, can you explain a bit more about the problem?
- Kevin_Davies_40
Nacreous
Johny,
Anytime you use "and" or "or" they must only be dealing with true or false comparisons. You must use brackets to ensure this or you will get errors or unexpected results.
if { [string tolower [HTTP::uri]] equals "/" and ([HTTP::host] eq "abc.com" or [HTTP::host] eq "www.abc.com")} {Should be...
if {([string tolower [HTTP::uri]] equals "/") and (([HTTP::host] eq "abc.com") or ([HTTP::host] eq "www.abc.com"))} {
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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