Forum Discussion

cd_312641's avatar
cd_312641
Icon for Nimbostratus rankNimbostratus
Apr 02, 2019

Irule redirect to the right pool depending hostname

Hello,

I have a VS which can be accessed from 3 urls, can you help me with an irule on a F5 DMZ VS to redirect to the right node/pool on F5 LAN VS (.45, .46 ,.47) depending to the domain name from which the customer comes

Something like :

if I come from https://aaa.domain.fr redirect to .45 node,
           if https://bbb.domain.fr redirect to .46
           if https://ccc.domain.fr redirect to .47

This, could be working ?

when HTTP_REQUEST {
 Check requested host header (set to lowercase) 
switch [string tolower [HTTP::host]] { 

   "https://aaa.domain.fr" { 
      pool AAA_Pool 
   } 
   "https://bbb.domain.fr" { 
      pool BBB_Pool 
   } 
   default { 
      pool CCC_Pool
   } 
}

Thanks

1 Reply

  • The HTTP::host item does not include the "; text. Try this:

    when HTTP_REQUEST {
     Check requested host header (set to lowercase) 
    switch [string tolower [HTTP::host]] { 
    
       "aaa.domain.fr" { 
          pool AAA_Pool 
       } 
       "bbb.domain.fr" { 
          pool BBB_Pool 
       } 
       default { 
          pool CCC_Pool
       } 
    }