Forum Discussion
Smartphone detection
Hi: kindly i need an IRULE that when a smartphone need to access URL www.mysite.com\AAA to redirect it to another link www.mysite.com\BBB
thanks for help
8 Replies
- nitass
Employee
e.g.
config root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm virtual bar ltm virtual bar { destination 172.28.20.15:80 ip-protocol tcp mask 255.255.255.255 pool foo profiles { http { } tcp { } } rules { myrule } source 0.0.0.0/0 source-address-translation { type automap } vs-index 29 } root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm rule myrule ltm rule myrule { when HTTP_REQUEST { if { [string tolower [HTTP::uri]] equals "/aaa" } { if { [class match -- [string tolower [HTTP::header "User-Agent"]] contains mobile_useragent] } { HTTP::respond 302 noserver Location "http://[HTTP::host]/BBB" Connection Close } } } } root@(ve11a)(cfg-sync In Sync)(Active)(/Common)(tmos) list ltm data-group internal mobile_useragent ltm data-group internal mobile_useragent { records { iphone { } } type string } test [root@ve11a:Active:In Sync] config curl -I http://172.28.20.15/AAA -H "User-Agent: Apple-iPhone5C1/1001.405" HTTP/1.0 302 Found Location: http://172.28.20.15/BBB Connection: close Content-Length: 0 - azakaria_102538
Nimbostratus
thank you for your help
it working now with your Irule
thanks
- azakaria_102538
Nimbostratus
hi: its working in http, but when i try for https it doesnt , i need https://www.mysite.com/aaa to redirect to https://www.mysite.com/bbb is the irule configuration should be change?
thanks
- nitass
Employee
i need https://www.mysite.com/aaa to redirect to https://www.mysite.com/bbb is the irule configuration should be change?
you changed location header from http to https, didn't you?
HTTP::respond 302 noserver Location "https://[HTTP::host]/BBB" Connection Close - azakaria_102538
Nimbostratus
i try but it didnt work thanks
- nitass
Employee
can you post the virtual server configuration and irule here?
e.g.
tmsh list ltm virtual (virtual server name)
tmsh list ltm pool (pool name)
tmsh list ltm rule (irule name) - azakaria_102538
Nimbostratus
please see the IRULE
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] equals "/ar/e-services" } { if { [class match -- [string tolower [HTTP::header "User-Agent"]] contains Mobile_Datagroup ] } { HTTP::respond 302 noserver Location "https://[HTTP::host]/ar/home" Connection Close } } }
- nitass
Employee
can you add some logging?
e.g.
when HTTP_REQUEST { log local0. "client=[IP::client_addr]:[TCP::client_port] host=[HTTP::host] uri=[HTTP::uri]" if { [string tolower [HTTP::uri]] equals "/ar/e-services" } { if { [class match -- [string tolower [HTTP::header "User-Agent"]] contains Mobile_Datagroup ] } { HTTP::respond 302 noserver Location "https://[HTTP::host]/ar/home" Connection Close } } }
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