Forum Discussion
help on uri redirect w/ filtered IP's
I'm searching for a way to filter IP's while doing a uri redirect any thoughts? I do have corresponding data groups, IE list "d" and list "e"
when HTTP_REQUEST {
if { ([string tolower [HTTP::uri]] contains "/d")
}{ HTTP::redirect "https://abc.de.com//site/d/"}
if { ([string tolower [HTTP::uri]] contains "/e")
}{ HTTP::redirect "https://abc.de.com//site/e/"}
}
Popossibly something along the lines of
if {([string tolower [HTTP::uri]] contains "/d") and { [class match [IP::client_addr] equals d] }
Thanks in advance for the help.
1 Reply
- P_K
Altostratus
If you already have a IP datagroup then.. try this
when HTTP_REQUEST {
if { [class match [IP::client_addr] equals IP_group] && [string tolower [HTTP::uri]] contains "/d" } {
HTTP::redirect "https://abc.de.com[HTTP::uri]"
}
elseif { [class match [IP::client_addr] equals IP_group] && [string tolower [HTTP::uri]] contains "/e" } {
HTTP::redirect "https://abc.de.com[HTTP::uri]"
}
}Please note that uri path that contains is only redirected to path before the , everything after will be sliced away. In your case, it will only redirect to https://abc.de.com/ since you have a symbol after that.
Hash sign is treated as fragment and path after is never sent to server by any browser. Hope this helps!
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
