Forum Discussion

NewTOF501_15047's avatar
NewTOF501_15047
Icon for Nimbostratus rankNimbostratus
Apr 20, 2014

switch is not working

when HTTP_REQUEST {

switch -glob {string tolower [HTTP::uri]] ends_with }
{


    "/NCCA"        { HTTP::redirect "http://oservices.bahrain.bh/wps/portal/NCCA"}
    "/EskanBank"   { HTTP::redirect "http://oservices.bahrain.bh/wps/portal/EskanBank"}
    "/ncs"         { HTTP::redirect "http://oservices.bahrain.bh/wps/portal/ncs" } 
    "/neaf"        { HTTP::redirect "http://oservices.bahrain.bh/wps/portal/neaf" }
    "/infosafe"    { HTTP::redirect "http://oservices.bahrain.bh/wps/portal/infosafe"}


}

}

5 Replies

  • e.g.

    [root@ve11a:Active:In Sync] config  tmsh list ltm virtual bar
    ltm virtual bar {
        destination 172.28.24.10:162
        ip-protocol udp
        mask 255.255.255.255
        profiles {
            udp { }
        }
        rules {
            qux
        }
        source 0.0.0.0/0
        vs-index 9
    }
    [root@ve11a:Active:In Sync] config  tmsh list ltm rule myrule
    ltm rule myrule {
        when HTTP_REQUEST {
      switch -glob [HTTP::path] {
        "/NCCA*" { HTTP::redirect "http://oservices.bahrain.bh/wps/portal/NCCA" }
        "/EskanBank*" { HTTP::redirect "http://oservices.bahrain.bh/wps/portal/EskanBank" }
        "/ncs*" { HTTP::redirect "http://oservices.bahrain.bh/wps/portal/ncs" }
        "/neaf*" { HTTP::redirect "http://oservices.bahrain.bh/wps/portal/neaf" }
        "/infosafe*" { HTTP::redirect "http://oservices.bahrain.bh/wps/portal/infosafe" }
        default {
           do something
        }
      }
    }
    }
    
    [root@ve11a:Active:In Sync] config  curl -I http://172.28.24.10/NCCA/something
    HTTP/1.0 302 Found
    Location: http://oservices.bahrain.bh/wps/portal/NCCA
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    [root@ve11a:Active:In Sync] config  curl -I http://172.28.24.10/EskanBank/something
    HTTP/1.0 302 Found
    Location: http://oservices.bahrain.bh/wps/portal/EskanBank
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    [root@ve11a:Active:In Sync] config  curl -I http://172.28.24.10/ncs/something
    HTTP/1.0 302 Found
    Location: http://oservices.bahrain.bh/wps/portal/ncs
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    [root@ve11a:Active:In Sync] config  curl -I http://172.28.24.10/neaf/something
    HTTP/1.0 302 Found
    Location: http://oservices.bahrain.bh/wps/portal/neaf
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    [root@ve11a:Active:In Sync] config  curl -I http://172.28.24.10/infosafe/something
    HTTP/1.0 302 Found
    Location: http://oservices.bahrain.bh/wps/portal/infosafe
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    [root@ve11a:Active:In Sync] config  curl -I http://172.28.24.10/
    HTTP/1.1 200 OK
    Date: Sun, 20 Apr 2014 09:42:16 GMT
    Server: Apache/2.2.3 (CentOS)
    Last-Modified: Sun, 09 Feb 2014 08:39:51 GMT
    ETag: "41879c-59-2a9c23c0"
    Accept-Ranges: bytes
    Content-Length: 89
    Content-Type: text/html; charset=UTF-8
    
    
    • NewTOF501_15047's avatar
      NewTOF501_15047
      Icon for Nimbostratus rankNimbostratus
      i want to know if we disable VS then is this possible to show maintenance page
  • e.g.

    [root@ve11a:Active:In Sync] config  tmsh list ltm virtual bar
    ltm virtual bar {
        destination 172.28.24.10:162
        ip-protocol udp
        mask 255.255.255.255
        profiles {
            udp { }
        }
        rules {
            qux
        }
        source 0.0.0.0/0
        vs-index 9
    }
    [root@ve11a:Active:In Sync] config  tmsh list ltm rule myrule
    ltm rule myrule {
        when HTTP_REQUEST {
      switch -glob [HTTP::path] {
        "/NCCA*" { HTTP::redirect "http://oservices.bahrain.bh/wps/portal/NCCA" }
        "/EskanBank*" { HTTP::redirect "http://oservices.bahrain.bh/wps/portal/EskanBank" }
        "/ncs*" { HTTP::redirect "http://oservices.bahrain.bh/wps/portal/ncs" }
        "/neaf*" { HTTP::redirect "http://oservices.bahrain.bh/wps/portal/neaf" }
        "/infosafe*" { HTTP::redirect "http://oservices.bahrain.bh/wps/portal/infosafe" }
        default {
           do something
        }
      }
    }
    }
    
    [root@ve11a:Active:In Sync] config  curl -I http://172.28.24.10/NCCA/something
    HTTP/1.0 302 Found
    Location: http://oservices.bahrain.bh/wps/portal/NCCA
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    [root@ve11a:Active:In Sync] config  curl -I http://172.28.24.10/EskanBank/something
    HTTP/1.0 302 Found
    Location: http://oservices.bahrain.bh/wps/portal/EskanBank
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    [root@ve11a:Active:In Sync] config  curl -I http://172.28.24.10/ncs/something
    HTTP/1.0 302 Found
    Location: http://oservices.bahrain.bh/wps/portal/ncs
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    [root@ve11a:Active:In Sync] config  curl -I http://172.28.24.10/neaf/something
    HTTP/1.0 302 Found
    Location: http://oservices.bahrain.bh/wps/portal/neaf
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    [root@ve11a:Active:In Sync] config  curl -I http://172.28.24.10/infosafe/something
    HTTP/1.0 302 Found
    Location: http://oservices.bahrain.bh/wps/portal/infosafe
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    [root@ve11a:Active:In Sync] config  curl -I http://172.28.24.10/
    HTTP/1.1 200 OK
    Date: Sun, 20 Apr 2014 09:42:16 GMT
    Server: Apache/2.2.3 (CentOS)
    Last-Modified: Sun, 09 Feb 2014 08:39:51 GMT
    ETag: "41879c-59-2a9c23c0"
    Accept-Ranges: bytes
    Content-Length: 89
    Content-Type: text/html; charset=UTF-8
    
    
    • NewTOF501_15047's avatar
      NewTOF501_15047
      Icon for Nimbostratus rankNimbostratus
      i want to know if we disable VS then is this possible to show maintenance page
  • i want to know if we disable VS then is this possible to show maintenance page

     

    no, i understand you can disable pool but not virtual server.