cancel
Showing results for 
Search instead for 
Did you mean: 

irule pool selection based on host AND path

JQB
Nimbostratus
Nimbostratus

Below is my current irule, which sends all requests with "/up/*" in the path to the faweb pool, otherwise, requests are sent to the default web pool.

 

when HTTP_REQUEST {   switch -glob [string tolower [HTTP::path]] {     "/up/*" { pool faweb }   default { pool web }   } }

 

I am looking to modify the rule so that only specific hosts with "/up/*" in the path will go straight to the default web pool.

 

Example;

 

https://host1.website.com/up/foo.txt

https://host2.website.com/up/bar.txt

https://host3.website.com/up/dog.txt

 

should all go directly to default web pool

 

AND

 

https://host7.website.com/up/apple.txt

https://host8.website.com/up/orange.txt

https://host9.website.com/up/banana.txt

and any other hose not listed in the first list above (host1, host2, host3)

 

should all go to the faweb pool

 

 

1 ACCEPTED SOLUTION

Hi JQB,

when HTTP_REQUEST { switch [string tolower [HTTP::host]] { "host1.website.com" - "host2.website.com" - "host3.website.com" { pool web } default { switch -glob [string tolower [HTTP::path]] { "/up/*" { pool faweb } default { pool web } } } } }

 

View solution in original post

2 REPLIES 2

Hi JQB,

when HTTP_REQUEST { switch [string tolower [HTTP::host]] { "host1.website.com" - "host2.website.com" - "host3.website.com" { pool web } default { switch -glob [string tolower [HTTP::path]] { "/up/*" { pool faweb } default { pool web } } } } }

 

Worked like a charm. Thank you.