Forum Discussion

Pradeep_menon_1's avatar
Pradeep_menon_1
Icon for Nimbostratus rankNimbostratus
Jan 29, 2015

irule required for redirection

following URLS to go to a pool containing 10.10.10.25:8080 and 10.10.10.89:8080 The following urls should go to the pool.

 

http(s)://abc.com/ht360services/ http(s)://abc.com/ordermanager/ http(s)://abc.com/bicommonui else all other request should go to the default pool.

 

below is the script i wrote, please review it and let me know wr i went wrong. if {[HTTP::uri] matches_regex "abc/ordermanager"} { pool pool_abc_ordermanager } elseif {[HTTP::uri] matches_regex "abc.com/ht360services"} { pool pool_abc_ordermanager } elseif {[HTTP::uri] matches_regex "abc.com/bicommonui"} { pool pool_abc_ordermanager } else { pool pool_abc.com } }

 

1 Reply

  • You could use a switch statement instead, which would be more efficient. This should help.

    switch -glob -- [string tolower "[HTTP::host][HTTP::uri]"] {
        "*abc.com/ordermanager*" -
        "*abc.com/ht360services*" -
        "*abc.com/bicommonui*" {
            pool pool_abc_ordermanager
        }
        default {
            pool pool_abc.com
        }
    }