Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

F5 Reverse Proxy setup

kashif_shahzad
Nimbostratus
Nimbostratus

Hi,

i have started using F5 newly and not comfortable with iRules yet. 

Need help for a reverse proxy setup.

have 2 domain urls:

https://exampel.com/Biz/v2-xy/soapbridge/PT/*

https://exampel.com/Biz/v2/api/XY/SI.Data.RPC/SI.Data.RPC/*

these should go to one pool. And

http://site1.com/AD/V1/

http://site1.com/HR/V1/

should go to another pool.

Can some expert here help in writing a iRule to achieve this.

1 ACCEPTED SOLUTION

Hi @kashif_shahzad , 
please try this : 

when HTTP_REQUEST { 
 if {[HTTP::host] eq "exampel.com"}{ 
  pool pool_1
 } elseif {[HTTP::host] eq "site1.com"}{ 
     pool pool_2
}
}

> Make sure with pools names within irule as it must be identical with pool name itself , usually I copy pool name and paste it within irule to make sure the names are identical. 

> We can do your request by anothe approache , Do you know about Local traffic policy , it is a very useful tool in f5 and can replace iRule in many implementations but not all as irule used in more complex approaches. 
> if you need me to implement your request by Local traffic policy instead of irules , I’d love to do that definitly. 

I hope this helps you. 
regards 

_______________________
Regards
Mohamed Kansoh

View solution in original post

4 REPLIES 4

Hi @kashif_shahzad , 
please try this : 

when HTTP_REQUEST { 
 if {[HTTP::host] eq "exampel.com"}{ 
  pool pool_1
 } elseif {[HTTP::host] eq "site1.com"}{ 
     pool pool_2
}
}

> Make sure with pools names within irule as it must be identical with pool name itself , usually I copy pool name and paste it within irule to make sure the names are identical. 

> We can do your request by anothe approache , Do you know about Local traffic policy , it is a very useful tool in f5 and can replace iRule in many implementations but not all as irule used in more complex approaches. 
> if you need me to implement your request by Local traffic policy instead of irules , I’d love to do that definitly. 

I hope this helps you. 
regards 

_______________________
Regards
Mohamed Kansoh

Hi Mohamed,

thanks a lot for your quick response.

If we use host in the Irule it will open all the undersites from internet. 

if {[HTTP::host] eq "exampel.com"}

I was thinking a more specific logic to just open those url,s that come with these subdirectories in the url:

https://exampel.com/Biz/v2-xy/soapbridge/PT/*

means only  url's that has host exampel.com plus /BIZ/v2-xy/soapbridge/PT/xxxxx , 

/BIZ/v2-xy/soapbridge/PT/yyyyyy and so on.

i have tried policies but was unable to get the desired results. may be i was missing something.

 

 

Hi @kashif_shahzad , 
yes it simple because it forwards traffic based on host name in urls regardless what exists in the rest of requests , it is only looking for Requests hostnames 

Regards

_______________________
Regards
Mohamed Kansoh

Its really simple using the Local Traffic Policy as already mentioned.

PSFletchTheTek_0-1669115926043.png

You can also make it to another virtual server.

PSFletchTheTek_2-1669115982381.png

Which is something called VIP targetting VIP, basically a layer 7 NAT.
It comes in very useful for use cases when you have only 1 IP, but need to host multiple domains/subdomains.