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

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

stupid48
Altocumulus
Altocumulus

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 6

Samir
MVP
MVP

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.

stupid48
Altocumulus
Altocumulus

Which switch condition are you referring to?

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

stupid48
Altocumulus
Altocumulus

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

stupid48
Altocumulus
Altocumulus

I don't know why I didn't see this article before but it appears to explain why it's not working. I had to add a "return" command after the first switch block.

 

https://support.f5.com/csp/article/K23237429

stupid48
Altocumulus
Altocumulus

Thanks for your help by the way....