Forum Discussion

DFeike_160744's avatar
DFeike_160744
Icon for Nimbostratus rankNimbostratus
Jan 06, 2015

referencing the VS default pool as destination in iRule

Hi Fellows 🙂

my customer has the following requirement, the webservice shall be only available via https and ssloffload and in case http traffic arrives, a redirect VS shall do the job, except for certain domains. If the one of the exceptions hits the port80 redirect VS the traffic shall be forwarded to the default pool of the VS in http.

so here is, what i've come up with(untested)

when HTTP_REQUEST {
  switch [string tolower [HTTP::host]] {    
    "www.domain-a.de" { pool pool_mypool_prod-80 }
    "www.domain-b.de" { pool pool_mypool_prod-80 }  
    "www.domain-c.de" { pool pool_mypool_prod-80 }
    "default" { HTTP::redirect "https://[HTTP::host][HTTP::uri]" }
  }
}

Since i'd like to use the same iRule on preproduction VS and the production VS it would be cool if can reference the assigned default pool of the VS in the iRule.

Thanks in advance David

3 Replies

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus

    David,

    How about something like this:

    when CLIENT_ACCEPTED {
         Save the name of the VS default pool
        set default_pool [LB::server pool]
    }
    when HTTP_REQUEST {
      switch [string tolower [HTTP::host]] {    
        "www.domain-a.de" -
        "www.domain-b.de" -
        "www.domain-c.de" { 
            send these to default pool
           pool $default_pool 
           }
        default { HTTP::redirect "https://[HTTP::host][HTTP::uri]" }
      }
    }
    

    I've not got my lab bigip available to can't test but hopefully it'll do the job you require.

    N

  • Hi Nathan,

     

    that's a great idea. Thanks for your advise.

     

    Best regards David