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

Karthick_01_150's avatar
Karthick_01_150
Icon for Nimbostratus rankNimbostratus
Apr 22, 2014

IRULE for API related configuration

We have webserver in our environment and application hosted in our internal webserver, we have provided the API services from our internal APP server.

 

The traffic flow as below

 

Client initiate the traffic ----->to our webserver ----->our internal APPserver ------>various merchant API url.

 

From our internal server we have provide the URL access via f5 through virtual server the backend pool will be the merchant URL by using irule.

 

The problem here is , there are multiple URL with same context .for example

 

xyz.com/user/main.html abc/user/main.html cde/user/main.html

 

So likewise the domain only changing in each URL but context will be same for all the URL. How can we achieve the configuration with the help of irule.

 

Thanks in advance

 

3 Replies

  • How can we achieve the configuration with the help of irule.

     

    can you give an example what you want to achieve?

     

  • Hi,

     

    Thanks for your reply.

     

    This is outbound connectivity for f5, so traffic initiated from the server to external public url. from server the external URL are called through f5 VIP and Vport.

     

    So traffic flow is internal server --->F5 VIP-->public URL as pool member using IRULE config

     

    Requirement here is need to map many public URL (domains) for single VIP/port using IRULE.

     

    IF the context different we can create a irule as below .

     

    when HTTP_REQUEST { switch -glob [HTTP::uri] {

     

    "/example*" {

     

    http://portal.com/example/abc/abc.html

    pool abc } } }

     

    But in this scenario the context is same for all URLs but domain will be different.

     

    Thanks

     

  • can't we use HTTP::host?

    HTTP::host

    https://devcentral.f5.com/wiki/iRules.http__host.ashx
    [root@ve11a:Active:In Sync] config  tmsh list ltm rule qux
    ltm rule qux {
        when HTTP_REQUEST {
      log local0. "\[HTTP::host\]=[HTTP::host] \[HTTP::uri\]=[HTTP::uri]"
    }
    }
    
    [root@ve11a:Active:In Sync] config  tail -f /var/log/ltm
    Apr 21 22:10:30 ve11a info tmm[13593]: Rule /Common/qux : [HTTP::host]=xyz.com [HTTP::uri]=/user/main.html
    Apr 21 22:10:49 ve11a info tmm1[13593]: Rule /Common/qux : [HTTP::host]=abc.com [HTTP::uri]=/user/main.html
    Apr 21 22:10:56 ve11a info tmm[13593]: Rule /Common/qux : [HTTP::host]=cde.com [HTTP::uri]=/user/main.html