Forum Discussion

John_Base_11768's avatar
John_Base_11768
Icon for Nimbostratus rankNimbostratus
Nov 22, 2013

Redirect to specific port/page

Hi, I have a request from our applications group to create a VIP that redirects to a pool, and in that pool the members go to port 7001/apex

 

I setup the pool with port 7001 for the servers, and an Irule that I thought would do the redirect to the /apex page: when HTTP_REQUEST { HTTP::header replace Host "[HTTP::host]/apex" } however, it seems to just go to port 7001. Any help would be appreciated as I am a novice at iRules.

 

4 Replies

  • Hi, you need to use the HTTP::uri command, not HTTP::header - no need to modify the host, just the URI.

     

    Do you just want to direct to /apex if no URI has been specified (/) or in all cases? My concern is that a request to /apex/some/path/index.html will be redirected to /apex.

     

  • I think this is the safest way;

    when HTTP_REQUEST {
     if { [HTTP::uri]] equals "/" } {
      HTTP::redirect "/apex/" }
    } 
    
  • Thanks - After my application owner stopped by, what he really wants is a proxypass rule, as he doesn't want the end users to ever see www.somesite.com/apex - just www.somesite.com

     

    It also turns out they are not load balancing the application - so even though I could do it on the F5 - they can also do the same thing on the server in Apache - they just wanted to use the F5 so they don't have to update the cert on the server when it expires.

     

    • What_Lies_Bene1's avatar
      What_Lies_Bene1
      Icon for Cirrostratus rankCirrostratus
      OK, if you haven't already, there are many examples to be found here on DC.