Forum Discussion
iRule match & processing exit
- Nov 17, 2022
Hi Stefan_Engel,
In your code, a redirect loop occurs because the redirected page always starts with "intranet". Can you try this iRule?
when HTTP_REQUEST { if { [HTTP::host] starts_with "intranet" && [HTTP::uri] equals "/AAA/" } { pool intranet_pool return } elseif { [HTTP::host] starts_with "intranet" && [HTTP::uri] equals "/BBB/" } { pool intranet_pool return } elseif { [HTTP::host] starts_with "intranet" && [HTTP::uri] ne "/" } { HTTP::redirect https://intranet.new return } }
If the uri is not "/", it will redirect.
If the uri is "/", it will not redirect, traffic will be forwarded to the default pool.
If there is no character after the hostname in url, the uri is always "/".
Hi Stefan_Engel,
In your code, a redirect loop occurs because the redirected page always starts with "intranet". Can you try this iRule?
when HTTP_REQUEST {
if { [HTTP::host] starts_with "intranet" && [HTTP::uri] equals "/AAA/" } {
pool intranet_pool
return
} elseif { [HTTP::host] starts_with "intranet" && [HTTP::uri] equals "/BBB/" } {
pool intranet_pool
return
} elseif { [HTTP::host] starts_with "intranet" && [HTTP::uri] ne "/" } {
HTTP::redirect https://intranet.new
return
}
}
If the uri is not "/", it will redirect.
If the uri is "/", it will not redirect, traffic will be forwarded to the default pool.
If there is no character after the hostname in url, the uri is always "/".
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