Forum Discussion

Gavin_Coulthar1's avatar
Gavin_Coulthar1
Historic F5 Account
Jul 20, 2010

selective URI rewrite based on pool member

Hi, i have a customer who would like to selectively rewrite the URI path based on which pool member has been selected. i.e. http://vip/App and rewrite to http://server1/App1 or http://server1/App2 these are 2 instances running within the one webserver so the URI path is different. with careful selection of the pool member names etc would a stream profile do the trick or will we need to have a combination of an irule for the inbound content and a stream profile for the outbound ?
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hi Gavin,

     

     

    So there are two instances of an application running on the same web service? What advantage does the customer gain by load balancing between two different URIs on the same service? I'd have assumed it would use the same resources on the web server and not provide any performance improvement. Or do the different app instances talk with different backend databases or other infrastructure?

     

     

    You couldn't use standard pool load balancing if the two application instances share an IP address and port as these are the two properties which define a pool member. Could you assign two different IP addresses to the web server? If so, you could then use default LTM load balancing and more easily rewrite the URI based on the selected IP:port. You could start with this Codeshare example which rewrites the host header based on the selected pool member. I'd try just rewriting the request URI and see if it works. You might not need to rewrite response headers or content.

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/rewrite_host_header_to_server_name

     

     

    Which LTM version is the customer running? For 10.x, I'd suggest using the class command instead of findclass as it appears it the class command might be a lot more efficient than findclass.

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/class

     

     

    Aaron
  • Posted By hoolio on 07/20/2010 01:13 AM

     

    Hi Gavin,

     

     

    So there are two instances of an application running on the same web service? What advantage does the customer gain by load balancing between two different URIs on the same service? I'd have assumed it would use the same resources on the web server and not provide any performance improvement. Or do the different app instances talk with different backend databases or other infrastructure?

     

     

    You couldn't use standard pool load balancing if the two application instances share an IP address and port as these are the two properties which define a pool member. Could you assign two different IP addresses to the web server? If so, you could then use default LTM load balancing and more easily rewrite the URI based on the selected IP:port. You could start with this Codeshare example which rewrites the host header based on the selected pool member. I'd try just rewriting the request URI and see if it works. You might not need to rewrite response headers or content.

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/rewrite_host_header_to_server_name

     

     

    Which LTM version is the customer running? For 10.x, I'd suggest using the class command instead of findclass as it appears it the class command might be a lot more efficient than findclass.

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/class

     

     

    Aaron

     

     

    From what I'm reading, he must have multiple IPs on the box, otherwise I'm not sure how he has multiple pool members...definitely seems like a when LB_SELECTED, host header replace scenario.
  • Gavin_Coulthar1's avatar
    Gavin_Coulthar1
    Historic F5 Account
    ...its a long story as to why it is what it is in terms of 2 instances on the same web server - this is an interim solution.
  • Posted By Gavin Coulthard on 07/20/2010 07:14 PM

     

    ...its a long story as to why it is what it is in terms of 2 instances on the same web server - this is an interim solution.

     

     

    Do the instances have multiple IPs or same IP, different ports, or are the instances simply different directories?