Forum Discussion

kamlyada_209668's avatar
kamlyada_209668
Icon for Nimbostratus rankNimbostratus
Jul 29, 2016

Need an Irule for below request

Hello,

 

Created the VIP on F5 and two below nodes attached vip call for the moment - http://uat1-jboss7.digital-solutions.kamlesh.com:8080/ http://uat2-jboss7.digital-solutions.kamlesh.com:8080/

 

pool member need to be call with context here-

 

http://uat1-jboss7.digital-solutions.kamlesh.com:8080/rest2ldap http://uat2-jboss7.digital-solutions.kamlesh.com:8080/rest2ldap

 

Need an Irule for the same Please help and suggest .Thanks in advance.

 

Regards kamlesh Y

 

1 Reply

  • Hi Kamlesh,

    to add a leading subfolder for every incomming HTTP request, you may use the iRule below as a starting point...

    when HTTP_REQUEST {
    
        HTTP::uri "/rest2ldap[HTTP::uri]"
    
    }
    

    Note: Keep in mind, that this iRule would change request for

    /
    to
    /rest2ldap/
    but also
    /something
    to
    /rest2ldap/something
    or even
    /somethingother
    to
    /rest2ldap/somethingother
    . If you require just some URIs to become changed, then you have to use additional
    [if]
    or
    [switch]
    conditions to filter the URIs where the translation is required.

    when HTTP_REQUEST {
        if { ( [HTTP::uri] equals "/" ) or ([string tolower [HTTP::uri]] starts_with "/something") } then {
             Change the URI
            HTTP::uri "/rest2ldap[HTTP::uri]"
        } else {
             Do not change the URI...
        }
    }
    

    Cheers, Kai