Forum Discussion
Gerald_Meese
Cirrus
May 22, 2018HTTP::redirect loop
Hello,
I'm trying to write a small iRule to create redirects to specific paths on an internal server based on the presence/absence of the 'order' parameter in the requested URI :
when HTTP_REQUE...
Stanislas_Piro2
Cumulonimbus
May 22, 2018Here is a code which will prevent redirect loops
when HTTP_REQUEST {
Make sure only the login page matches the code, to prevent all requests to be redirected to login page (like images CSS, and other web pages)
if {[HTTP::path] equals "/Login.aspx"} {
set order [URI::query [HTTP::uri] order]
set context [URI::query [HTTP::uri] context]
Don't redirect if context already equals 3
if { $order ne "" && $context != 3 } {
HTTP::redirect /Login.aspx?guestlogin=1&order=${order}&context=3
Redirect if order is null and guestlogin doesn't equal 1
} elseif {$order == "" && [URI::query [HTTP::uri] guestlogin] ne 1} {
HTTP::redirect /Login.aspx?guestlogin=1
}
}
}
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