Forum Discussion
Redirect to pool member based on URI with persistence
We are implementing Kronos 8 with SSL offloading on our LTM. The SSL offload options in Kronos forces all traffic through the LTM so our Kronos admin can no longer hit the application directly on the individual servers. To accomplish this I need to direct traffic directly to the pool member based on URI. I also need to append /wfc/logon to all URIs. I have built an iRule based on examples I have found here, but it doesn't work correctly. It lands on the initial logon page correctly, but after the logon doesn't persist to the pool member.
Process I am trying to accomplish:
- http://kronos.xxx.edu/ap1 -> https://kronos.xxx.edu/wfc/logon on pool member 1
- http://kronos.xxx.edu/ap2 -> https://kronos.xxx.edu/wfc/logon on pool member 2
-
http://kronos.xxx.edu/ -> https://kronos.xxx.edu/wfc/logon default LB for clients
Allow server selection via uri when HTTP_REQUEST { if {[HTTP::uri] contains "ap1" } { HTTP::uri "/wfc/logon" pool Kronos member 192.168.1.121 80 } elseif {[HTTP::uri] contains "ap2"} { HTTP::uri "/wfc/logon" pool Kronos member 192.168.1.122 80 } elseif {[HTTP::uri] eq "/"} { HTTP::uri "/wfc/logon" pool Kronos } }
Any suggestions are greatly appreciated.
- Andy_McGrathCumulonimbus
Careful you do not direct them to the logon page all the time and i would look at using switch instead of if elseif but put an if as a top level trigger, only do this if the URI starts with "/ap" then just strip the "/apx" from the uri.
Think the following should do the job:
Allow server selection via uri when HTTP_REQUEST { set uri [string tolower [HTTP::uri]] if {$uri eq "/"} { HTTP::uri "/wfc/logon" } elseif {$uri starts_with "/ap"} { switch -glob $uri { "/ap1" { pool Kronos member 192.168.1.121 80 HTTP::uri [string map {"/ap1" ""} $uri] } "/ap2" { pool Kronos member 192.168.1.122 80 HTTP::uri [string map {"/ap2" ""} $uri] } "/ap3" { pool Kronos member 192.168.1.123 80 HTTP::uri [string map {"/ap3" ""} $uri] } } } }
- Stanislas_Piro2Cumulonimbus
Hi,
you have to create 2 virtual servers:
- http virtual server to redirect HTTP URLs to HTTPS. assign the default _sys_https_redirect irule.
- https virtual server to manage
Apply this irule to the HTTPS virtual server
HTTPS virtual server irule when HTTP_REQUEST { switch -glob -- [HTTP::path] { "/wfc/logon" { switch -glob -- [URI::query [HTTP::uri] app] { "ap1" { pool Kronos member 192.168.1.121 80 HTTP::uri "/wfc/logon" } "ap2" { pool Kronos member 192.168.1.122 80 HTTP::uri "/wfc/logon" } default {pool Kronos } } } "/ap1" {HTTP::respond 307 Location "/wfc/logon?app=ap1" } "/ap2" {HTTP::respond 307 Location "/wfc/logon?app=ap2" } "/" {HTTP::respond 307 Location "/wfc/logon" } } }
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