Forum Discussion
Tony2020
Nimbostratus
Aug 30, 2018Redirect to pool based on URI not working
Hi All,
I am having issues with a redirect within an Irule.
Here is what I am trying to do.
If users coming from the internet (not matching datagroup 10.0.0.0/8) and they go to
"/test" ...
Stanislas_Piro2
Cumulonimbus
Aug 30, 2018you can use following code
when CLIENT_ACCEPTED {
set internal_network [class match [IP::client_addr] equals DG-INTERNAL-IP]
set insert_cookie 0
}
when HTTP_REQUEST {
if {$internal_network} {
pool TESTPOOL_443
} elseif {[URI::query [HTTP::uri] bypassMaintenance] equals "true"} {
HTTP::respond 302 Location [HTTP::path] "Set-Cookie" "bypassMaintenance=true;path=/"
} elseif {[URI::query [HTTP::uri] bypassMaintenance] equals "false"} {
HTTP::respond 302 Location [HTTP::path] "Set-Cookie" "bypassMaintenance=false;expires=Thu, 01-Jan-1970 00:00:01 GMT;path=/"
} elseif {[HTTP::cookie value bypassMaintenance] equals "true"} {
pool TESTPOOL_443
} else {
HTTP::redirect "http://maintenance.test.com"
}
}
the bypass uri is :
/?bypassMaintenance=true
or
/WhateverYouWant?bypassMaintenance=true
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