cancel
Showing results for 
Search instead for 
Did you mean: 

Host based irule & URI to point to backend pool

Preet_pk
Nimbostratus
Nimbostratus

Hi,

We have a requirement to forward application access to backend server pool based on "host" and "uri".

Below is the requirement.

If host is "abc.local.ae" & uri is "/malla"  -> then pool - "abc-pool:8080"

If host is "abc.local.ae" & uri is "/mise"  -> then pool - "abc-pool:8081"

Please let me the iRule syntax whih will meet the above requirement.

 

 

1 ACCEPTED SOLUTION

Hi @Preet_pk 

If site/url is not working after mapping pool directly to the vServer then the issue is something else. 

Can you verify below configurations ?

1. SNAT settings on the vServer. If backend server's default gateway is not F5 then make sure to enable SNAT settings. You can set it to AUTOMAP.

2. Is your pool showing up on the F5? Check if you have correct routing on the F5 to reach backend server.

Once this is sorted. then you can test the iRule.

View solution in original post

7 REPLIES 7

PSFletchTheTek
Cirrocumulus
Cirrocumulus

Hi,

Does this have to be done by a irule.
it can be done very quickly and easily using a local traffic policy.

I can send you some config, if it can be a LTP not a iRule. (I'm not on top of irules yet!)

 

 Here you go, something like this. (Wanted to try the new devcentral out with photos! Very easy now!)

ltp example.PNG

 

I would like to know the difference between http-URI /a and /a/, thank you

Hi @Preet_pk ,

I agree with @PSFletchTheTek , LTM policy will be more easier & also those are more faster when it comes to execution. Still if you want to user iRule, you can refer below irule for your use case.

 

when HTTP_REQUEST {

if {[HTTP::host] equals "abc.local.ae"} {
    
    if {[HTTP::uri] contains "malla"} {
       
        pool abc-pool:8080
    } elseif {[HTTP::uri] contains "mise"} {
        
        pool abc-pool:8081
    } 
}

}

Hope it helps!

Hi,

Thanks for sharing the irule, tested the irule but it is not work. Below is the configuration details. Tried creating seperate VS & applied pool abc-pool:8080 directly for tesing instead of irule - still it is not working. Please let me know if F5 will not process traffic if, we are using port 443 on VS &  backend server on port 8080 - as i am not able to see any traffic statistics on pool members while testing the connectivity & in browser getting "PR_CONNECT_RESET_ERROR" . Even in Packet capture can see F5 VS ip resetting the traffic to client ip address - instead of processing backend server connectivity.

VS:

10.120.10.10    Port 443

Backend irule:

when HTTP_REQUEST {

if {[HTTP::host] equals "abc.local.ae"} {

if {[HTTP::uri] contains "malla"} {

pool abc-pool:8080
} elseif {[HTTP::uri] contains "mise"} {

pool abc-pool:8081
}
}

}

 

 

Hi @Preet_pk 

If site/url is not working after mapping pool directly to the vServer then the issue is something else. 

Can you verify below configurations ?

1. SNAT settings on the vServer. If backend server's default gateway is not F5 then make sure to enable SNAT settings. You can set it to AUTOMAP.

2. Is your pool showing up on the F5? Check if you have correct routing on the F5 to reach backend server.

Once this is sorted. then you can test the iRule.

Hi,

Thanks for the details. Issue is sorted out - issue was due to missing route to backend application server subnet in F5.