cancel
Showing results for 
Search instead for 
Did you mean: 

TCL error redirect if active_members == 0

Ammar
Nimbostratus
Nimbostratus

Dear 

 

when HTTP_REQUEST {

switch -glob -- [string tolower [HTTP::path]] {

"/dashboard/*" {
## dashboard
if { [active_members dashboard] == 0 }
{
log local0. "Pool dashboard donw"
HTTP::redirect "https://example.com"
}
pool /Common/dashboard
persist cookie insert
}
default {
reject

}

}

TCL error: /Common/dashboard_iRule <HTTP_REQUEST> - Can't call after responding - ERR_NOT_SUPPORTED (line 1) invoked from within "HTTP::uri" ("/dashboard/*" arm line 13) invoked from within "switch -glob -- [string tolower [HTTP::path]] { "/dashboard/*" { ##dashboard/Dsh/* pool /Common/dashboard ..."

Br

 

3 REPLIES 3

Samir
Nacreous
Nacreous

Pool name "dashboard" n path URI is same. Change the pool name of active_members.

Schuppe
Nimbostratus
Nimbostratus

HTTP iRule commands that inspect HTTP state after the commands HTTPrespond, HTTPredirect and HTTPretry will now return errors instead of returning corrupt data.

MaximP
Cirrus
Cirrus

It should work like this, without partition reference in pool name

when HTTP_REQUEST {

switch -glob -- [string tolower [HTTP::path]] {
"/dashboard/*" {
## dashboard
if { [active_members dashboard] == 0 }
{
log local0. "Pool dashboard donw"
HTTP::redirect "https://example.com"
}
pool dashboard
persist cookie insert
}
default {
reject
}
}
}