Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

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

 

2 REPLIES 2

Samir
MVP
MVP

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

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
}
}
}