For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

t_rajneesh_2252's avatar
t_rajneesh_2252
Icon for Nimbostratus rankNimbostratus
Oct 08, 2015

Irule to redirect the traffic to UAt app on PROD server

Hi All,

 

I required your experitse help in creating Irule :

 

scenerio:

 

We have production server on which both PROD url www.abc.com & UAT url uat.abc.com are hosted.

 

On F5, we have One VIP (with two pool members). This VIP is natted with Public IP on Firewall.They have created alias DNS record for uat.abc.com which resolves to same Public ip as PROD url www.abc.com.

 

Hence both come with same public IP and hits the VIP on F5. I wanted to create a IRule where when user tried to connect to uat.abc.com, the request need to be sent to UAT site on webserver. Your help is highly appreciable.

 

Thanking you in advance.

 

Regards, Rajneesh

 

3 Replies

  • Pretty straight forward to do in an iRule:

    when HTTP_REQUEST {
        switch [string tolower [HTTP::host]] {
            "www.abc.com" {
                pool abc_pool
            }
            "uat.abc.com" {
                pool uat_pool
            }
            default {
                pool abc_pool
            }
        }
    }
    

    You can also do this without iRules with an LTM policy configuration. In either case you'll also want a OneConnect profile applied to the VIP: specific OneConnect profile + OneConnect enabled in the HTTP profile.

  • Thanks Kevin for your quick help..I will get this Irule tested tommorow and will let you know the result.

     

    Regards, Rajneesh

     

  • Hi Kevin,

     

    The above irule didnt worked as expected and inturn took down working PROD url www.abc.com too.

     

    What was done : I have created a new pool uat_pool and mapped exisiting pool_members of abc_pool to new pool uat_pool: Created Irule as you mentioned above & applied it to VS of abc_pool. After this , we were not able to access both uat.abc.com and www.abc.com.

     

    Please let me know if anything need to be corrected or other way to get this requirement done.

     

    Regards, Rajneesh