Forum Discussion

VJ_96387's avatar
VJ_96387
Icon for Nimbostratus rankNimbostratus
Feb 22, 2010

URL REDIRECTION!!!

Hi there,

 

 

I am near to F5 irules and need your help regarding the below requirement.

 

 

I need to redirect the

 

 

http://abc-a.xyz.com (accessed via internet)

 

https://abc-a.xyz.com (accessed via internet)

 

http://abc-a.xyz.corp (accessed internally)

 

https://abc-a.xyz.corp (accessed internally)

 

 

to be redirected to

 

 

https://abc-a-xyz.corp/irj/portal

 

 

 

The VIP is on a single host 10.10.10.10 and runs service ports on 80 and 443.

 

 

Please help me on howto accomplish this via Irules?

 

 

Awaiting your response.

 

 

TIA

 

 

Regards,

 

 

VJ

5 Replies

  • Hi VJ,

    You can check the URI (everything after the hostname[:port] in the URL) using HTTP::uri or the path (URI minus the query string) using HTTP::path. You can rewrite the URI and path with these same commands. Or you can send a 302 redirect using HTTP::redirect.

    If you want to redirect all requests to / to /irj/portal, you can use:

      
      when HTTP_REQUEST {  
        
          Check requested URI  
         if {[HTTP::uri] eq "/"}{  
        
             Redirect client  
            HTTP::redirect "https://abc-a-xyz.corp/irj/portal"  
         }  
      }  
      

    Aaron
  • Aaron,

     

     

    Thanks for your reply. Assume yow want me to apply this irule to all both VIP's.

     

     

    i.e. 10.10.10.10:80 & 10.10.10.:443.

     

     

    Please advise?

     

     

    TIA

     

     

    VJ
  • That's correct. The rule can be applied to all VIPs where you want to redirect the client from / to the URL.

     

     

    Note that I incorrectly had the event for the rule set to CLIENT_ACCEPTED. That needs to be HTTP_REQUEST instead.

     

     

    Aaron