There are many departments: department1, department2, department3, etc… and I don’t know what they are or will be. So I like the the “department1/user” or “department2/user” to be the "/user" but I am not sure how to insert the department wildcard in the http redirect (HTTP::redirect "http://[HTTP::host]/).
I am trying with “getfield”. I modified the iRules to be like these: when HTTP_REQUEST { if the request is from the trusted network segments if {[IP::addr [IP::client_addr] equals 10.10.10.5/32] or [IP::addr [IP::client_addr] equals 192.168.100.0/24]} { log local0. “First IF” pool seattle-only return } if the request is from untrusted network segment switch -glob [string tolower [HTTP::uri]] { “/user” { HTTP::redirect “http://[HTTP::host]” } “/*/user” { set new-uri [getfield [HTTP::uri] “/” 2 HTTP::redirect “http://[HTTP::host]/$new-uri” } default { pool seattle-only } } }
I checked my recent post and somehow the wildcard asterisk () are disappeared in the “user” and "(HTTP::redirect “http://[HTTP::host]/)” They are supposed to be "/user" and "(HTTP::redirect “http://[HTTP::host]/*)”
If you want to keep trying with filtering on the “/user” you could try using “contains”. I have had success with that. However it is a bit more open-ended so it will take it if it is anywhere in the URI.
when HTTP_REQUEST { if {([HTTP::uri] contains "/user") }{ HTTP::Redirect yourdestinationhere }}
I think you might just have to use a variable pointing to a data group and populate that data group with what departments/names that might be used. It seems that maybe there are two many variables to do this in a straight-forward iRule.