Forum Discussion

al_kabeer_2905's avatar
al_kabeer_2905
Icon for Nimbostratus rankNimbostratus
Nov 25, 2011

Create Friendly URL

Hi i have bigIp LTM, v11 OS

 

 

 

i want to create friendly URL instead typing big URL to access the application, i google and found the below html code

 

 

i just want to fit the following in the code:

 

 

my URL "http://10.10.1.10:4030/xyzbnhtyijhgful/ccvvddaa

 

 

 

i want to be http://10.10.1.10

 

 

 

 

 

how can write the code below to fit my requirments

 

 

 

when HTTP_REQUEST {

 

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

 

"/ug/atl" {

 

HTTP::redirect "http://[HTTP::host]/a7391/users/0928179/events/live/release/20110403/regions.php?region=atl"

 

}

 

"/ug/sea" {

 

HTTP::redirect "http://[HTTP::host]/a2416/users/0622375/events/live/release/20100602/regions.php?region=sea"

 

}

 

}

 

}whenHTTP_REQUEST {

 

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

 

"/ug/atl" {

 

HTTP::redirect"http://[HTTP::host]/a7391/users/0928179/events/live/release/20110403/regions.php?region=atl"

 

}

 

"/ug/sea" {

 

HTTP::redirect"http://[HTTP::host]/a2416/users/0622375/events/live/release/20100602/regions.php?region=sea"

 

}

 

}

 

}

 

 

 

Thanks

 

 

 

when HTTP_REQUEST {

 

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

 

"/ug/atl" {

 

HTTP::redirect "http://[HTTP::host]/a7391/users/0928179/events/live/release/20110403/regions.php?region=atl"

 

}

 

"/ug/sea" {

 

HTTP::redirect "http://[HTTP::host]/a2416/users/0622375/events/live/release/20100602/regions.php?region=sea"

 

}

 

}

 

}

 

 

 

 

 

6 Replies

  • is 10.10.1.10:4030 virtual server? if so, is this what you are asking?

    root@ve1100(Active)(/Common)(tmos) list ltm virtual bar
    ltm virtual bar {
        destination 172.28.19.252:80
        ip-protocol tcp
        mask 255.255.255.255
        profiles {
            http { }
            tcp { }
        }
        rules {
            myrule
        }
        vlans-disabled
    }
    root@ve1100(Active)(/Common)(tmos) list ltm rule myrule
    ltm rule myrule {
        when HTTP_REQUEST {
            switch [string tolower [HTTP::uri]] {
                    "/" { HTTP::redirect "http://[HTTP::host]:4030/xyzbnhtyijhgful/ccvvddaa" }
                    default {
                            HTTP::redirect "http://[HTTP::host]:4030[HTTP::uri]"
                    }
            }
    }
    }
    
    root@ve1100(Active)(/Common)(tmos) list ltm virtual bar2
    ltm virtual bar2 {
        destination 172.28.19.252:4030
        ip-protocol tcp
        mask 255.255.255.255
        pool foo
        profiles {
            http { }
            tcp { }
        }
        snat automap
        vlans-disabled
    }
    root@ve1100(Active)(/Common)(tmos) list ltm pool foo
    ltm pool foo {
        members {
            200.200.200.101:80 {
                address 200.200.200.101
            }
        }
    }
    
    [root@ve1100:Active] config  curl -I http://172.28.19.252
    HTTP/1.0 302 Found
    Location: http://172.28.19.252:4030/xyzbnhtyijhgful/ccvvddaa
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    [root@ve1100:Active] config  curl -I http://172.28.19.252/test
    HTTP/1.0 302 Found
    Location: http://172.28.19.252:4030/test
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 0
    
    
  • hi nitass,

     

     

    yes 10.10.1.10 is VIP, i am not using CLI, i am using GUI, so i will create IRULE and put the code inside, and then go to virtual server proparties and add the irule,

     

     

    so can you only the code

     

     

    thanks again
  • so can you only the codesorry i cannot catch what you want to say. what is the problem please?
  • hi,

     

     

    i only want the html code that i should put in Irule, i am not familier with html language

     

    the code is:

     

     

    when HTTP_REQUEST {

     

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

     

    "/ug/atl" {

     

    HTTP::redirect "http://[HTTP::host]/a7391/users/0928179/events/live/release/20110403/regions.php?region=atl"

     

    }

     

    "/ug/sea" {

     

    HTTP::redirect "http://[HTTP::host]/a2416/users/0622375/events/live/release/20100602/regions.php?region=sea"

     

    }

     

    }

     

    }

     

     

    i want this code be sustituded with my input which is

     

     

    Big URL : http://10.10.1.10:4030/xyzbnhtyijhgful/ccvvddaa

     

    URL : http://10.10.1.10:4030

     

     

    so that i can paste the code to the IRule and add it to VIP

     

     

    thanks
  • the existing irule is applied to virtual server which is listening on port 4030, isn't it?

     

     

    if yes, can you try this one?

     

     

    when HTTP_REQUEST {

     

    switch [string tolower [HTTP::uri]] {

     

    "/" {

     

    HTTP::redirect ""

     

    }

     

    "/ug/atl" {

     

    HTTP::redirect ""

     

    }

     

    "/ug/sea" {

     

    HTTP::redirect ""

     

    }

     

    }

     

    }

     

     

    this is my testing.

     

     

    [root@ve1100:Active] config tmsh list ltm virtual bar

     

    ltm virtual bar {

     

    destination 172.28.19.252:4030

     

    ip-protocol tcp

     

    mask 255.255.255.255

     

    pool foo

     

    profiles {

     

    http { }

     

    tcp { }

     

    }

     

    rules {

     

    myrule

     

    }

     

    snat automap

     

    vlans-disabled

     

    }

     

    [root@ve1100:Active] config tmsh list ltm rule myrule

     

    ltm rule myrule {

     

    when HTTP_REQUEST {

     

    switch [string tolower [HTTP::uri]] {

     

    "/" {

     

    HTTP::redirect ""

     

    }

     

    "/ug/atl" {

     

    HTTP::redirect ""

     

    }

     

    "/ug/sea" {

     

    HTTP::redirect ""

     

    }

     

    }

     

    }

     

    }

     

    [root@ve1100:Active] config curl -I http://172.28.19.252:4030

     

    HTTP/1.0 302 Found

     

    Location: http://172.28.19.252:4030/xyzbnhtyijhgful/ccvvddaa

     

    Server: BigIP

     

    Connection: Keep-Alive

     

    Content-Length: 0

     

     

    let me know if i still misundertood what you are asking.