Forum Discussion

John_Yeo_48557's avatar
John_Yeo_48557
Icon for Nimbostratus rankNimbostratus
Feb 02, 2006

redirect for specifiic URI with offsite web servers

Need to use BigIP 4.5.13 to perform redirect only - there is no load balance pool for servers. We own the "mydomain.com" and can point that DNS record to our BigIP, but the servers are located and managed offsite for both "mydomain.com" and "redirectdomain.com"

 

 

Request is to redirect only http://www.mydomain.com/a/b to http://redirectdomain.com/b

 

 

How do I perform a redirect for only URI /a/b to just URI /b and have everything else e.g http://www.mydomain.com or http://www.mydomain.com/x not use a redirect when the DNS for "mydomain.com" will point to BigIP and there is no pool?
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    That would look something like:

    
    if ( (http_host == "mydomain.com") and (http_uri == "/a/b") ) {
      redirect to http://redirectdomain.com/b
    }

    Now, assuming you want to take whatever /b is from the initial request and pass it on to the new server, then you'd have to do something a little more involved:

    
    if ( (http_host ends_with "mydomain.com") and (http_uri == "/a/b") ) {
      redirect to "http://redirectdomain.com" + getfield(http_uri, '/', 3)
    }

    I think this is pretty close to what you're looking for. Let me know if you have further questions.

    -Colin