Forum Discussion
dlegran2_264710
Nimbostratus
May 27, 2016Simple redirect irule - keeping VIP name in browser instead of full redirect url
Team , I am still very new to iRules and I am trying to get the code syntax for a simple URL redirect and Browser check to work based on my requirement. My VIP name is the following http://abc-la...
Yann_Desmarest
Cirrus
May 27, 2016Hi,
The browser display the request he has done in foreground. To achieve your requirement, you need to :
- use iframes so that the main url remain http://abc-lab.def.test.com
or
-
change the way it works :
when HTTP_REQUEST { check for browser-type switch -glob [HTTP::header value "User-Agent"] { "MSIE 6" - "MSIE 7" - "MSIE 8" { If MSIE, log IP, port & browser-type. Logs are written to /var/log/ltm log local0. "[IP::client_addr]:[TCP::client_port] :[HTTP::header User-Agent] : Matched MSIE." If MSIE, redirect to Capri Redirect page HTTP::redirect "http://[HTTP::host]:2200/Redirect_url" } default { If other browser, log IP, port & browser-type. Logs are written to /var/log/ltm log local0. "[IP::client_addr]:[TCP::client_port] :[HTTP::header User-Agent] : Matched default pool" switch -glob [HTTP::path] { "/" { If other browser, forward to default pool HTTP::redirect "/xyz" } default { node host1 9500 } } } } }
- dlegran2_264710May 27, 2016
Nimbostratus
Yann...appreciate fast response based on my example what are the value i should set for node host1 9500 - Yann_DesmarestMay 27, 2016
Cirrus
Hi, in that case, your viewable app url remain http://abc-lab.def.test.com. If you redirect the user to http://abc-lab.def.test.com:9500, this is this url that will be viewed in the browser - Yann_DesmarestMay 27, 2016
Cirrus
So, with your irule, the VIP that has this irule never go to a pool but redirect every request to a different app or vip. - Yann_DesmarestMay 27, 2016
Cirrus
In my irule, all the traffic goes through this VS - dlegran2_264710May 27, 2016
Nimbostratus
Yann..thanks for your suggestion did test it and work correctly now. Last question I now have is how/what to change in order to handle two/three nodes (ie High availability) as for now you suggest to use : default { node host1 9500 which only point to one node. Thanks - Yann_DesmarestMay 27, 2016
Cirrus
Hi, you change this command by "pool mypool" and you create a pool of nodes. - dlegran2_264710May 27, 2016
Nimbostratus
Always sounds easy when you know :-) Really appreciate your VALUABLE feedback Yann. Have a good week end
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects