Forum Discussion

ST_Wong's avatar
ST_Wong
Icon for Cirrus rankCirrus
Jul 20, 2015

Please help: "Pool" in iRule breaks AJAX scripts?

Hi,

 

We use following simple irules for pool selection:

 

------------ cut here ---------
when HTTP_REQUEST {
  if { [HTTP::uri] starts_with "/psreports/" } {
    log local0. "Debug: using thrsit_psreports"  
    pool hrsit_b_pool   
  } 
}
------------ cut here ---------

It works for some years until recently the software upgraded and AJAX scripts are used. It returns error when following sequence occurs

 

  1. user access through default pool.
  2. user click on links with pattern "/psreports/". Request served by pool hrsit_b_pool without problem.
  3. user click on links without pattern "/psreports/". Suppose default pool is used. Then got error like following:

Function 'xxx' Error: Unable to get property 'indexOf' of undefined or null reference. The error occurs somewhere near the code below:

 

 try
 {
 var loader=this; this.req.onreadystatechange=function()
 {
 loader.onReadyState.call(loader); }

Then after 1 to 2 minutes, the link in step 3 above can be clicked without problem. I'm newbie to AJAX or Javascript, but just wonder if serving same browser session with different pools will break methods for "this" object, or did I go to the wrong direction?

 

Would anyone please help?

 

Thanks a lot. /ST Wong

 

1 Reply

  • Hi ST Wong,

    Your best bet is to have your developers debug the site and see if the requests are getting the correct responses. If not then you have an issue with your iRule sending you to the wrong pool.

    You might also try to add an "else" to your if statement and see if that helps.

    ------------ cut here ---------
    when HTTP_REQUEST {
      if { [HTTP::uri] starts_with "/psreports/" } {
        log local0. "Debug: using thrsit_psreports"  
        pool hrsit_b_pool   
      } else {
        pool default_pool_name
      }
    }
    ------------ cut here ---------
    

    Hope this helps!

    Seth