Forum Discussion

Christofer_Tib1's avatar
Christofer_Tib1
Icon for Nimbostratus rankNimbostratus
May 31, 2006

How to forward requests to subfolders in pool?

Hi,

 

 

I'm very sorry for my simple question!

 

 

We have an incomming https://x.x.x.x/prod/ups that needs to be changed/passed on to http://y.y.y.y/receiver/ups.

 

 

We have created a pool for y.y.y.y but how can we get it to /receiver/ups/ ?

 

 

Is there any simple wat to do that?

 

 

Many thanks in advance.

 

 

2 Replies

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    The best way to do this, if you're actually intending to change the protocol as well as the URI, is via a standard HTTP redirect. This would look like:

    
    when HTTP_REQUEST {
      HTTP::redirect "http://x.x.x.x/receiver/ups"
    }

    Note that I used "x.x.x.x"...this would be a redirect back to the hostname or IP of the Virtual in question. This would, however, hit a different VIP, since it would come in on port 80, rather than port 443.

    So, you'd have to VIPs set up with the same IP, one on port 443, with the above rule applied, and one on port 80, without the above rule.

    The second VIP would have your pool as a resource, and traffic would be passed to the servers with the modified URI.

    The other option would be to terminate SSL on the BIG-IP, and modify the URI before the request was sent to the server, and re-write it on the way to the client, but that's more involved. If having a redirect in place is an acceptable solution, it's much simpler.

    HTH,

    Colin
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    If (as Colin mentions) you're terminating SSL at the BIG-IP, and you just need to forward to the server in cleartext but with a different URI, you could use something like:
    when HTTP_REQUEST {
      if { [HTTP::uri] eq "/prod/ups" } {
          [HTTP::uri] "/receiver/ups"
          pool y.y.y.y
      }
    }
    If you need to replace the "/prod/ups" string and leave the rest of a longer URI intact, you can use string map:
    when HTTP_REQUEST {
      if { [HTTP::uri] starts_with "/prod/ups" } {
          [HTTP::uri] [string map {/prod/ups /receiver/ups} [HTTP::uri]] 
          pool y.y.y.y
      }
    }
    /deb