Forum Discussion

Greg_33129's avatar
Greg_33129
Icon for Nimbostratus rankNimbostratus
Jul 09, 2009

Need assistance with a URL Replacement

All,

 

 

We are using 1500's with version 9 in a pair. I have taken an urgent request for the F5 to intercept a URL and take the user to a different site (while maintaining the original URL. Here is what I need to do:

 

 

When someone types this into their browser:

 

 

https://test.secure.mycompany.com/apps/bmv/irecords/

 

 

I need the irule to take them to:

 

 

http://newserver.mycompany.com:47080/apps/bmv/irecords/

 

 

1. Not sure if the trailing slash is needed, But I need to reroute to a differnt server with everything after irecords/ remaining the same.

 

2. It needs to show the user the original url

 

 

"https://test.secure.mycompany.com/apps/bmv/irecords/" and everything that comes after it.

 

 

I have searched the Forums and haven't found an article that addresses all of these aspects.

 

 

Kind Regards,

 

Greg
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Hi Greg,

     

     

    You can use the ProxyPass iRule to proxy an external hostname/URI to an internal hostname/URI. The IP and TCP layer translations are handled by your VIP/pool configuration. The VIP would be defined on an external IP:443 and the pool members would be defined on internal IPs:47080. The ProxyPass rule will rewrite the host and URIs in the request and optionally rewrite the response headers and payload. There is a v10 example and one for 9.x:

     

     

    http://devcentral.f5.com/Wiki/default.aspx/iRules.CodeShare

     

     

    Aaron
  • hoolio's avatar
    hoolio
    Icon for Cirrostratus rankCirrostratus
    Actually, if you only need to replace the Host header in requests and the app uses all local references (no references in response headers or payload to newserver.mycompany.com:47080, you can use a simple iRule:

     
     when HTTP_REQUEST { 
      
         Rewrite host header 
        HTTP::header replace Host "newserver.mycompany.com:47080" 
     } 
     

    Again, the load balancing will handle the IP and port translation from the VIP IP:port to the pool member IP and port.

    You might try testing this option first before delving into the much more functional (and complicated) ProxyPass rule.

    Aaron