Forum Discussion

Wes_98712's avatar
Wes_98712
Icon for Nimbostratus rankNimbostratus
Mar 17, 2006

images irule

I have a strange problem, one that I can't seem to figure out, probably because I'm not thinking it through. I have the following rule:

 

 


else if (http_uri ends_with one of images) {
   use pool p_cdimaging8001
}

 

 

That works great, but when I go to http:///branch.html the post function to search for a branch fails because the images end up getting cached in the cdimaging8001 pool (which is a netcache device), the post function essentially takes your source address (e.g. home or business) and prints out directions to a branch. If I add the following code the post function works:

 

 


else if (http_uri ends_with one of images and not http_uri starts_with "branch.html") {
   use pool p_cdimaging8001
}

 

 

The post function works just fine now, and the driving directions come up great, but the problem now is no images are getting sent to the cdimaging8001 pool. What I want is something that says, if the uri contains branch.html go to the pool and do not cache, so for branch.html it should go directly to the servers, the following doesn't work.

 

 


else if (http_uri starts_with "/branch.html") {
   use pool p_webpool
}
else if (http_uri ends_with one of images) {
   use pool p_cdimaging8001
}

 

 

What is the correct syntax to use here? For every other page we should cache, for this particular page we shouldn't cache.

 

 

Thoughts?

 

 

-Wes
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    Hi Wes --

     

     

    The 2nd half of this condition:

     

    else if (http_uri ends_with one of images and not http_uri starts_with "branch.html") {

     

    will always evaluate to TRUE, since URI's always start with "/".

     

     

    Your last code snip looks syntactically correct to me. I'd recommend adding some logging to each conditional branch of your rule to determine what conditions are actually being hit.

     

     

    If you need more assistance, it might be helpful if you included the class list and the full text of your rule.

     

     

    HTH

     

    /d
  • The class is the built in images class which contains .bmp .gif and .jpg among other things.

     

     

    I know that it will always equate to false depending on the condition (e.g. if there are images but the http_uri doesn't contain branches.html).

     

     

    The question is if the page starts with /branch.html, how do I use the p_cdimaging8001 for images but not if the current page is branch.html, I don't think it's possible.

     

     

    The problem is in J2EE the JSession breaks because it references objects in the HTML code that do not start with /branch.html, so inevitabley I will have 2 different or possibly more session ID's per the users initial page request which overwrite each other.

     

     

    In a nutshell I don't think it's possible, perhaps with version 9, but I don't think so with version 4 rules.
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    Each HTTP object, even images referenced within an HTML page, is a separate request, and each request can be sent to a different pool using logic similar to yours. It sounds like you need to be able to tell when an image is called by /branch.html. You can tell what page called the images by examining the "Referrer" header -- something to consider in building your conditions.

     

     

    Adding log statements such as "condtion X seen, using pool Y" can help reveal where your rule logic is broken, if that is indeed the case.

     

     

    But I could see how sending request to 2 different servers could interfere with jsessionid assignment such that one server's sessionID would overwrite the other's.

     

     

    Can you make the image servers stop generating a 2nd jsessionid? If it's just serving images, I would think the server doesn't need to create stateful sessions.

     

     

    If you can't prevent the 2nd sessionID from being set, in v9 you could intercept the 2nd jsessionid from the image server if the request came from that Referrer, and delete that cookie.

     

     

    HTH

     

    /d