Forum Discussion
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"
}
}
}
}
}
}
}
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
- nitass
Employee
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 - al_kabeer_2905
Nimbostratus
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 - al_kabeer_2905
Nimbostratus
hi nitass,
Any update
thanks - nitass
Employee
so can you only the codesorry i cannot catch what you want to say. what is the problem please? - al_kabeer_2905
Nimbostratus
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 - nitass
Employee
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.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com