Forum Discussion
Mariusz_B
Nimbostratus
Sep 05, 2014Problems with redirections
Hello,
This is my first post here, so welcome everybody 🙂
I need some help with redirecting from http back to https
We have few services which we setup on LTM. For some of them the requirement i...
Mariusz_B
Nimbostratus
Sep 17, 2014I have found solution which works fine, but I would like to combine two iRules into one, using switch -globe option.
iRule 1:
when HTTP_REQUEST {
if { ( [string trim [HTTP::uri]] contains "Client1" ) or [HTTP::cookie exists "BIGipServerab.example.com_Pool_1"]} {
set uri [HTTP::uri [string map {"/Client1/" "/"} [HTTP::uri]]]
pool ab.example.com_Pool_1
}
}
iRule 2:
when HTTP_REQUEST {
if { ( [string trim [HTTP::uri]] contains "Client2" ) or [HTTP::cookie exists "BIGipServerab.example.com_Pool_2"]} {
set uri [HTTP::uri [string map {"/Client2/" "/"} [HTTP::uri]]]
pool ab.example.com_Pool_2
}
}
I need to be able to add more clients, but I have to route them to either pool 1 or 2 only. If this is not possible I'll create 2 iRules with switch -globe, and place clients inside them respectively. It would be nice however to have only one iRule per VIP which does everything. Tried this, but LTM is complaining about the syntax:
when HTTP_REQUEST {
set client_name [string tolower [URI::path [HTTP::uri] 1 1]]
switch -glob [string trim [HTTP::uri]] {
"*Client1*"
"*Client3*"
"*Client5*"
switch -glob [HTTP::cookie] {
"BIGipServerab.example.com_Pool1" {
set uri [HTTP::uri [string map {"/$client_name/" "/"} [HTTP::uri]]]
pool ab.example.com_Pool1}
}
}
"*Client2*"
"*Client4*"
"*Client6*"
switch -glob [HTTP::cookie] {
"BIGipServerab.example.com_Pool2" {
set uri [HTTP::uri [string map {"/$client_name/" "/"} [HTTP::uri]]]
pool ab.example.com_Pool2
}
}
}
}
Any suggestions?
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