Forum Discussion
Redirect iRule that includes Operating System?
Hi - I'm working on building my first iRule for my LTM's. We want to redirect users based on user agent header info but along with the type of browser we want to also specify the users OS. I see the agent header info should have this data - "msie 8.0; windows nt 5.1" is anyone else doing this? Is this possible to accomplish without redirecting everyone using "MSIE 8.0" - only users with Windows XP?
An example of what I have put together:
when HTTP_REQUEST { if { [string tolower [HTTP::host][HTTP::uri]] contains "www.newsite.example.com" } { switch -glob [string tolower [HTTP::header User-Agent]] { "windows nt 5.1" - "android 2.3" { HTTP::redirect "http://www.browser-OS-refused.example.com" } } } }
- Brad_ParkerCirrus
you should be able to use nested IFs to accomplish your redirect or something like:
when HTTP_REQUEST { if { [string tolower [HTTP::header User-Agent]] contains "windows nt 5.1" && [string tolower [HTTP::header User-Agent]] contains "msie 8.0"}{ HTTP::redirect "http://www.browser-OS-refused.example.com" } }
- nitassEmployee
you should have to add special sequences (e.g. asterisk) in switch pattern (since it is not exact match).
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