Forum Discussion
kgaigl
Dec 23, 2021Cirrocumulus
2 IRules with "when HTTP_REQUEST"
Hello,
I need on a VS 2 IRules, one for redirect to a URI and one for a Maintanance Page:
redirect:
when HTTP_REQUEST {
if { [HTTP::uri] equals "/"}
{
HTTP::redirect "https://[H...
- Dec 23, 2021
Hi kgaigl,
I think a tcl error occurs. Can you investigate the ltm logs?
cat /var/log/ltm | grep "TCL error"
https://support.f5.com/csp/article/K23237429
Redirect:
when HTTP_REQUEST { if { [HTTP::has_responded] } { return } if { [HTTP::uri] equals "/" } { HTTP::redirect "https://[HTTP::host]/some-uri" return } }
Maintanance Page:
when HTTP_REQUEST priority 450 { if { [HTTP::has_responded] } { return } if { [active_members [LB::server pool]] < 1 } { switch [HTTP::uri] { "/bg-wappen.gif" { HTTP::respond 200 content [ifile get "bg-wappen.gif"] } default { HTTP::respond 200 content { <!DOCTYPE html> ...
Combined:
when HTTP_REQUEST { if { [HTTP::has_responded] } { return } if { [HTTP::uri] equals "/" } { HTTP::redirect "https://[HTTP::host]/some-uri" return } elseif { [active_members [LB::server pool]] < 1 } { switch [HTTP::uri] { "/bg-wappen.gif" { HTTP::respond 200 content [ifile get "bg-wappen.gif"] } default { HTTP::respond 200 content { <!DOCTYPE html> ...
Dec 23, 2021
Hi kgaigl,
I think a tcl error occurs. Can you investigate the ltm logs?
cat /var/log/ltm | grep "TCL error"
https://support.f5.com/csp/article/K23237429
Redirect:
when HTTP_REQUEST {
if { [HTTP::has_responded] } { return }
if { [HTTP::uri] equals "/" } {
HTTP::redirect "https://[HTTP::host]/some-uri"
return
}
}
Maintanance Page:
when HTTP_REQUEST priority 450 {
if { [HTTP::has_responded] } { return }
if { [active_members [LB::server pool]] < 1 } {
switch [HTTP::uri] {
"/bg-wappen.gif" { HTTP::respond 200 content [ifile get "bg-wappen.gif"] }
default { HTTP::respond 200 content {
<!DOCTYPE html>
...
Combined:
when HTTP_REQUEST {
if { [HTTP::has_responded] } { return }
if { [HTTP::uri] equals "/" } {
HTTP::redirect "https://[HTTP::host]/some-uri"
return
}
elseif { [active_members [LB::server pool]] < 1 } {
switch [HTTP::uri] {
"/bg-wappen.gif" { HTTP::respond 200 content [ifile get "bg-wappen.gif"] }
default { HTTP::respond 200 content {
<!DOCTYPE html>
...
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