Forum Discussion

stupid48's avatar
stupid48
Icon for Altocumulus rankAltocumulus
Jul 02, 2020

Getting "Can't call after responding" in LTM logs for iRule

Hi there,

It seems that after we upgraded our LTM, part of an iRule stopped working and the error in ltm logs doesn't explain why. I've got an iRule that will redirect an http request if the URI is either "" or "/". It also is supposed to send the request to a certain pool based on hostname. This was working. Now if only does the pool part and ignores the redirect. The ltm log generates this error each time:

Jul 1 17:22:46 bigip10 err tmm[12168]: 01220001:3: TCL error: /Common/CCB_iRule <HTTP_REQUEST> - Can't call after responding - ERR_NOT_SUPPORTED (line 😎   invoked from within "HTTP::host"

The iRule is as follows:

when HTTP_REQUEST {


switch -glob [string tolower [HTTP::uri]] {
   "" - 
    "/" {
       HTTP::redirect /ouaf
  }
}


switch [string tolower [HTTP::host]] {
    ccbtest.domain.com {
      pool ccbqa_pool
    }
    ccbprod.domain.com {
      pool ccbprd_pool
    }
    default {
      log local0. "Unknown site: [HTTP::host]"
    }
  }
}


Can someone give me some insight as to what I'm doing wrong?

Thanks much for your time...

6 Replies

  • Looks like issue on nasted switch condition. Can you club two switch condition in one or use if or elseif condition to solve issue as an workaround.

    • Samir's avatar
      Samir
      Icon for MVP rankMVP

      1st switch condition. We can club both switch in one statement.

  • If I try just doing an if statement for the first block, I still get the same error. It's strange that this used to work before the upgrade to 14.x. It's weird because the second switch is still working correctly even when the first entry is there. It just logs something to /var/log/ltm

    when HTTP_REQUEST {
     
    if {[HTTP::uri] equals "/"}{ 
                 HTTP::redirect "https://ccbprod.domain.com/ouaf"}
     
    switch [string tolower [HTTP::host]] {
        ccbtest.domain.com {
          pool ccbqa_pool
        }
        ccbprod.domain.com {
     
          pool ccbprd_pool
        }
        default {
          log local0. "Unknown site: [HTTP::host]"
        }
      }
    }