Forum Discussion

Ammar's avatar
Ammar
Icon for Nimbostratus rankNimbostratus
Mar 26, 2022

TCL error redirect if active_members == 0

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

 

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

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