Forum Discussion

3 Replies

  • The easier option may be to put each of these internal IP addresses into separate pools and then do something like this:

    when HTTP_REQUEST {
        switch -glob [string tolower [HTTP::uri]] {
            "/123*" { pool pool_123 }
            "/456*" { pool pool_456 }
            "/789*" { pool pool_789 }
        }
    }
    

    Where "pool_123" is the pool that contains the server with ipaddress1, etc. You're not technically redirecting but rather proxying the traffic. The client will only see the URL that they entered.

  • Thanks Kevin,

     

    We tried what you suggested. It looks like the irule proxies the traffic to "/123" on the destination URL. But I do not have the "/123". I expect it to directly proxy to ""

     

    Is there any special setting available to achieve this? Thanks for your help.

     

  • So there's no URI behind that address?

    when HTTP_REQUEST {
        switch -glob [string tolower [HTTP::uri]] {
            "/123*" { 
                HTTP::uri "/"
                pool pool_123 
            }
            "/456*" { 
                HTTP::uri "/"
                pool pool_456 
            }
            "/789*" { 
                HTTP::uri "/"
                pool pool_789 
            }
        }
    }
    

    This modification will replace the incoming URI with an empty one. Of course at this point you have to be careful about how the application works. If a browser requests http://external.domain.com/123, and you send that to the first pool and change the URI to "/" (from /123), how does the web server respond? Does it respond with HTML content that points back to a specific URI pattern (ex. /123/images/mycat.png)? If the HTML document that you get back contains document objects that the browser is expected to go get (images, styles, scripts, etc.), you'll have to take into account how those URIs will be presented to the client.