Forum Discussion

ALFONSO_SANTIA1's avatar
ALFONSO_SANTIA1
Icon for Nimbostratus rankNimbostratus
Oct 18, 2018

Combining or adding http and https requests

Customer has the following requirement. They have VIP with 4 pools.

What they want is the following:

If user requests "http://vip/something" go to poolA which is for Application A pool for port 80

If user requests "https://vip/something" go to poolB which is for Application A pool for port 443

If user requests "http://vip/" go to poolC which is for Application B pool for port 80

If user requests "https://vip/" go to poolD which is for Application B pool for port 443

I have managed so far this iRule to work:

when HTTP_REQUEST {

if { [string tolower [HTTP::uri]] contains "/+"} then { pool poolA 
} else {
if { ([HTTP::uri] == "/") } then { pool poolC
}
}

}

But this is only for http request.

how do I combine or add for the https requests?

2 Replies

  • HI

    you dont have to specify https request in the irule, if you terminate the ssl connection on the virtual server with a client and server ssl profile the f5 will be able to see the unencrypted http request, you can also ssl offload if you want by using a client ssl profile only. you can also configure the same virtual server ip address with different port numbers one for port 80 which will load balance where you want it to and for https 443, then in each virtual you can setup your irule to load balance to your specific pool. look at the rule below for some guidance you can more uri's. you can use the same irule on a https virtual server as long as you terminate the ssl on the f5 or ssl offload.

    when HTTP_REQUEST { switch -glob -- [string tolower [HTTP::path]] { "/something" { pool http_pool }

    default {
     pool defaulthttp_pool }
    

    } }

  • I see my irule did not post correctly here it is again

    when HTTP_REQUEST { switch -glob -- [string tolower [HTTP::path]] { "/something*" { pool http_pool }

        default {
            pool defaulthttp_pool }
        }
    }