Forum Discussion

Edgar_Palamarch's avatar
Edgar_Palamarch
Icon for Nimbostratus rankNimbostratus
Jul 16, 2015

iRule: Browser Error "The connection was reset"

Hello! I do appreciate your timely help with this issue I have.

 

I need to redirect all hits to specific URI to another pool keeping the same URI. Here is what I wrote that returns the above error:

 

when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/myuri" } { log local0. "redirect to New.pool" pool New.pool [HTTP::uri] } else { pool Old.pool } }

 

5 Replies

  • You don't need to re-apply the URI.

    when HTTP_REQUEST {     
        if { [string tolower [HTTP::uri]] starts_with "/myuri" } {         
            log local0. "redirect to New.pool"             
            pool New.pool
        } else {         
            pool Old.pool             
        }         
    }    
    

    You're very likely getting that error because of a logic error in the iRule. You'll also want to enable OneConnect in your VIP and in the associated HTTP profile.

  • Thanks, Kevin! That's what I figured out. Looks like iRules are smart enough to preserve URI's and query strings. :-)

     

    I don't have OneConnect enabled here. What would that change?

     

  • Hi, if you are intent to only select a pool, maybe it should be:

    when HTTP_REQUEST { 
        if { [string tolower [HTTP::uri]] starts_with "/myuri" } { 
            log local0. "redirect to New.pool"
            pool New.pool
        } else { 
            pool Old.pool 
        }
    }
    

    statement uri in "pool New.pool [HTTP::uri]" is unnecessary here.

    Hope it helps.
  • I don't have OneConnect enabled here. What would that change?

     

    What you're basically doing when you send traffic to different pools based on some request condition is something called "context switching". The problem is that load balancing decisions "stick" to the TCP session they're in. This becomes most apparent in a context switching environment when HTTP Keep-Alives are present. OneConnect allows you to load balance each request separately. Otherwise you may experience anomalous incorrect pooling.