Forum Discussion

cymru81's avatar
cymru81
Icon for Altocumulus rankAltocumulus
Aug 12, 2019

irule pool member help

we have a VIP that currently uses this irule:

 

##

# Notify the backend servers that this traffic was SSL offloaded by the F5.

##

when HTTP_REQUEST {

 HTTP::header insert "X-Forwarded-Proto" "https";

 HTTP::header remove "X-Forwarded-For"

HTTP::header insert "X-Forwarded-For" [IP::client_addr] 

}

 

this works as expected.

 

what we have is a pool though that has two members (2x IIS web servers), these aren't identical and not every site exists on both. Some of them do however and we would like to balance between the two. can we modify the irule in someway so we have granular control over which IP a request hits in a pool.

1 Reply

  • Hi Cymru81,

    You can create a pool for each site then select which to direct traffic to based on the hostname. If the site is on both IIS servers include them both as members, if not just have 1 as a member.

    ltm rule poolselect {
        when HTTP_REQUEST {
    		HTTP::header insert "X-Forwarded-Proto" "https";
    		HTTP::header remove "X-Forwarded-For"
    		HTTP::header insert "X-Forwarded-For" [IP::client_addr] 
    		
    		set httphost [string tolower [HTTP::host]]
            switch -glob $httphost {
                "site1.com" {
                    pool site1
                }
                "site2.com" {
                    pool site2
                }
                "site3.com" {
                    pool site3
                }			
                default {
                    HTTP::respond 404 noserver
                    TCP::close
                    event disable all
                }
            }
        }
    }