Silver_backAltostratusFeb 08, 2022URL redirect with path I am trying to create a redirect irule but is not a standard redirect. It basically needs to take the URL + path and redirect it to another website + the path of the old URL. E.g. www.abc.com/path1/...Show More
JRahmAdminFeb 08, 2022A couple comments/questions... All URLs start with "/", so as long as the host is www.abc.com, you'll never get to the else. There is no need to string tolower the host, that is case insensitive according to the RFC. Do you want any redirects if the host is not www.abc.com? If it's not, there is no additional logic to handle that. That said, assuming you don't need any redirects for the non-matching host, here's how I'd write that: when HTTP_REQUEST { if { ([HTTP::host] eq "www.abc.com") and not([HTTP::uri] eq "/") } { HTTP::respond 301 Location "http://jrahmtest.local[HTTP::uri]" event disable all } elseif { [HTTP::host] eq "www.abc.com" } { HTTP::respond 301 Location "http://jrahmtest.local/" event disable all } } Test results:
Recent DiscussionsNeed help with an iRule for HTTP Methodsfailed: Cannot contact any KDC for realmF5 VPN client + Endpoint InspectionTroubleshooting Bandwidth Limit Exceedance in Outlook Client Despite BWC PolicyWho is the good technical book publisher for first time author?
Related ContentCommunity Learning Path: Multi-Cloud NetworkingRedirect all request except few pathRedirect the domain name on URL, but keep path as the original URI pathTMOS Version Update PathsMultiple Kubernetes Clusters and Path-Based Routing with F5 Distributed Cloud