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

Assign specific uri to a server\node in pool

lior
Nimbostratus
Nimbostratus

Hi,

 

I'm new at Irules and I need help

I'm trying to create an I rule that searches for a server name in the URI ("server1/2/3")

and match it to the IP address of the server in the pool I created

but that's doesn't work

here an example

 

when HTTP_REQUEST {

set uri [string tolower [HTTP::uri]] 

 if { $uri contains "server1" } {

node 10.10.10.10

 }

 elseif { $uri contains "server2" } {

node 10.10.10.11

 }  

 else {

  pool test1

 }

}

 

 

1 ACCEPTED SOLUTION

SanjayP
MVP
MVP

You can create pool for server1 and server2 and use all services under service port while adding node. Reference that pool in the iRule and it should work.

when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]] 
if { $uri contains "server1" } {
pool pool1
} elseif { $uri contains "server2" } {
pool pool2
} else {
pool test1
 }
}

View solution in original post

4 REPLIES 4

Hi lior,

You must add port number for node command:

node 10.10.10.10 80
#or
node "10.10.10.11:443"

https://clouddocs.f5.com/api/irules/node.html

lior
Nimbostratus
Nimbostratus

Thank you Enes,

but the port number is not static

 

SanjayP
MVP
MVP

You can create pool for server1 and server2 and use all services under service port while adding node. Reference that pool in the iRule and it should work.

when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]] 
if { $uri contains "server1" } {
pool pool1
} elseif { $uri contains "server2" } {
pool pool2
} else {
pool test1
 }
}

lior
Nimbostratus
Nimbostratus

it works thank you