Forum Discussion
Vinod_F5_212422 Nimbostratus
Nimbostratus
Jul 22, 2015Rules to redirect based on URL
 Hi,    
 I have a web application that is deployed on 3 servers also 3 URL's to them     
  Server 1 (192.XXX.XXX.XXX) ==> http:\192.XXX.XXX.XXX\  Server 2 (192.XXX.XXX.YYY) ==> http:\192.XXX.XXX.YYY...
VernonWells Employee
Employee
Jul 22, 2015If the URI path is /User1, /User2 or /User3 (with nothing following), and you are using BIG-IP version 11.4 or higher, you can accomplish this using Local Traffic Policies:
If you are using a version before 11.4, you can use HTTP Classes:
If, instead, the URI path is, e.g., /User1/... (where ... is any arbitrary path) and you want to send everything after the /User1/ part to the server, then you'll need an iRule. Something like this:
when HTTP_REQUEST {
    switch -glob [HTTP::uri] {
        "/User1" -
        "/User1/*" { 
            HTTP::uri [substr [HTTP::uri] 6]
            node 192.168.1.1:80
        }
        
        "/User2" -
        "/User2/*" {
            HTTP::uri [substr [HTTP::uri] 6]
            node 192.168.2.1:80
        }
        
        "/User3" -
        "/User3/*" {
            HTTP::uri [substr [HTTP::uri] 6]
            node 192.168.3.1:80
        }
    }
}
This can be made more efficient, readable and configurable with the use of a datagroup.
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