Forum Discussion

bbensten_8485's avatar
bbensten_8485
Icon for Nimbostratus rankNimbostratus
May 02, 2014

Irule to redirect based on specific URI

A request comes in as host:x.x.x.x/path_1/VMRCConsole.html or path_1/WebMKSConsole.html and for some reason hits the "default" in this rule instead of the specific statement that is intended to redirect to the correct pool. Can someone tell me what I am missing? The majority of this rule works perfectly. path_1 is the same path in all of these statements so that may be part of the problem. The reason for the rule is that we do not want user to be able to go to /path_1 without specific URI on the end of it.

when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { “/unique*” { SSL::disable serverside pool pool_b

log local0. "[IP::client_addr] with URI of [HTTP::uri] went to pool_b
    } 


    "path_1/WebMKSConsole.html" {
        pool pool_A 

}

"path_1/org/*" { pool pool_A

} "path_1/VMRCConsole.html" { pool pool_A

} "path_1/support/*" { pool pool_A

} "path_1/amf/*" { pool pool_A

} "/transfer/*" { pool pool_A

}

default {

HTTP::redirect "https://some.page.for.redirects log local0. "Source IP address for connection to node: [IP::client_addr] [HTTP::uri]" }

}

}

1 Reply

  • Hi,

    you are applying a lower case conversion and therefor your jumplist needs to be lowercase as well:
    when HTTP_REQUEST {
        switch -glob [string tolower [HTTP::uri]] { 
            "/unique*" { 
                    SSL::disable serverside 
                    pool pool_b
                    log local0. "[IP::client_addr] with URI of [HTTP::uri] went to pool_b"
                } 
            "/path_1/webmksconsole.html" {
                    pool pool_A 
                } 
            "/path_1/org/*" { 
                    pool pool_A
                }
            "/path_1/vmrcconsole.html" {
                    pool pool_A
                }
            "/path_1/support/*" {
                    pool pool_A
                }
            "/path_1/amf/*" { 
                    pool pool_A
                }
            "/transfer/*" { 
                pool pool_A 
                }
            default { 
                HTTP::redirect "https://some.page.for.redirects
                log local0. "Source IP address for connection to node: [IP::client_addr] [HTTP::uri]"
            }
        }
    }