Forum Discussion

Aaron_Tebo_7015's avatar
Aaron_Tebo_7015
Icon for Nimbostratus rankNimbostratus
Sep 03, 2009

ProxyPass rule give error

I am using this rule from devcentral. http://devcentral.f5.com/wiki/default.aspx/iRules/ProxyPass.html

 

 

On some of my redirects I get the following error on execution:

 

 

TCL error: ProxyPasstestf5.harrisi.net HTTP_RESPONSE - Illegal argument. Cant execute in the current context. line 60 invoked from within HTTP::header $header foreach body line 2 invoked from within foreach header {Location Content-Location URI} { set protocol [substr [HTTP::header $header] 0 $host_serverside] if {$protocol ne ...

 

 

How can I troubleshoot to figureout why I am getting this error?

 

 

 

Thanks,

 

 

Aaron

6 Replies

  • Hi Aaron,

     

     

    Do you have any other iRules added to the virtual server? Which LTM version are you running?

     

     

    Aaron
  • Yes I have a 404 catch rule in addition to the proxypass rule. I am running 9.4.3.

     

     

     

    Thanks,

     

     

    Aaron
  • Can you post that iRule? I'd guess it's a conflict between the two rules when one is trying to remove a header from an LTM generated response.

     

     

    Aaron
  • Here is the 404 rule:

    when RULE_INIT {

    set error_404 {

    Page Not Found

    [HTTP::status] Error

    Page Not Found

    The requested URL
    $HTTP_URI
    was not found on this server.

    }

    }

    when HTTP_REQUEST {

    set HTTP_URI [HTTP::uri]

    log local0. [HTTP::host]

    log local0. [HTTP::path]

    }

    when HTTP_RESPONSE {

    log local0. [HTTP::status]

    log local0. [HTTP::host]

    if { [HTTP::status] == 404 } {

    HTTP::respond 404 content [subst $::error_404]

    }

    }
  • That sounds about right. You could add a check in the ProxyPass iRule to exit the HTTP_RESPONSE event immediately if the status is a 404. Something like this should work at the top of the ProxyPass HTTP_RESPONSE event:

     
     when HTTP_RESPONSE { 
      
         Exit this event in this rule if the server response is a 404 as we send a custom response for 404s from another rule 
        if {[HTTP::status] == 404}{ 
      
           return 
        } 
     } 
     

    Aaron
  • I will give that a try. I will let you know how it goes.

     

     

    Thanks,

     

     

    Aaron