Forum Discussion

Anil_Gupta_01_1's avatar
Anil_Gupta_01_1
Icon for Nimbostratus rankNimbostratus
Jun 25, 2014

irule for selecting pool based upon https website request

Hi,

 

We have Microsoft TMG server who is publishing our three website with one single Public IP address. As Microsoft TMG is EOL and EOS, We are planning to migrate the website on F5 LTM.

 

My Query is, how many VS, we need to create for publishing three website on F5 LTM and below irule will work if we create single VS and map the below irule.

 

We have created the below irule; need to know, whether it will work or not. when HTTP_REQUEST { if { [HTTP::uri] contains "aol.xyz.com" } { pool aol_pool } ifelse { [HTTP::uri] contains "yahoo.xyz.com" } { pool yahoo_pool } ifelse { [HTTP::uri] contains "google.xyz.com" } { pool google_pool } else { discard } }

 

any help is welcome.

 

Thanks in advance.

 

5 Replies

  • Try this:

    when HTTP_REQUEST { 
     if { [HTTP::host] equals "aol.xyz.com" } { 
      pool aol_pool 
     } elseif { [HTTP::host] equals "yahoo.xyz.com" } { 
      pool yahoo_pool 
     } elseif { [HTTP::host] equals "google.xyz.com" } { 
      pool google_pool 
     } else { discard } 
    }
    
    • Cory_50405's avatar
      Cory_50405
      Icon for Noctilucent rankNoctilucent
      To add to this, you must be terminating SSL on this virtual server in order to inspect the HTTP host header. Looks like you'll probably need a wildcard certificate for that if you don't already have one.
  • Here is a version that we implemented on an LTM 3600 running 9.4.5.

     

    Farm Name: firefly-qa-farms.qa.oclc.org:80

     

    rule firefly_qa_farm_to_pool_rule { when HTTP_REQUEST { if { [HTTP::header exists "Host"] } { set host_name [string tolower [HTTP::header "Host"]] set pool_name [findclass $host_name $::firefly_qa_name_to_pool_class " "] if { $pool_name ne "" } { use pool $pool_name } else { log local0. "No pool for host name:$host_name; TCP local port:[TCP::local_port]; client IP addr:[IP::client_addr];\ client TCP port:[TCP::client_port]; METHOD:[HTTP::method]; URI:[HTTP::uri]" reject } } else { log local0. "No Host in HTTP header; TCP local port:[TCP::local_port]; client IP addr:[IP::client_addr];\ client TCP port:[TCP::client_port]; METHOD:[HTTP::method];URI:[HTTP::uri]" reject } } }

     

    class firefly_qa_name_to_pool_class { "firefly-enva.qa.oclc.org firefly-enva_qa_7050" "firefly-envb.qa.oclc.org firefly-envb_qa_7050" "firefly-envc.qa.oclc.org firefly-envc_qa_7050" "firefly-envi.qa.oclc.org firefly-envi_qa_7050" "firefly-envj.qa.oclc.org firefly-envj_qa_7050" "firefly-envl.qa.oclc.org firefly-envl_qa_7050" "firefly-envm.qa.oclc.org firefly-envm_qa_7050" "firefly-envn.qa.oclc.org firefly-envn_qa_7050" "firefly-envo.qa.oclc.org firefly-envo_qa_7050" "firefly-envp.qa.oclc.org firefly-envp_qa_7050" "firefly-envr.qa.oclc.org firefly-envr_qa_7050" "firefly-envs.qa.oclc.org firefly-envs_qa_7050" "firefly-envt.qa.oclc.org firefly-envt_qa_7050" "firefly-envu.qa.oclc.org firefly-envu_qa_7050" "firefly-envx.qa.oclc.org firefly-envx_qa_7050" "firefly-envz.qa.oclc.org firefly-envz_qa_7050" "firefly-qaperf23.qa.oclc.org firefly-qaperf23_qa_7050" "firefly-qaperf24.qa.oclc.org firefly-qaperf24_qa_7050" }

     

  • one more small query;

     

    I hope, I need to create virtual server on port 443 (since end user will access via https) and need to create and select the irule as mention above.

     

    below is My pool details for reference. aol_pool is working on 8040 port; yahoo_pool is working on 8060 port; google_pool is working on 8080 port;