Forum Discussion

Hai_Le_36697's avatar
Hai_Le_36697
Icon for Nimbostratus rankNimbostratus
Jan 20, 2009

Non-cached redirects

Hello,

 

 

I would like to know if anyone can please help me with this problem. Basically what I am trying to do is to write an iRule that will redirect a user to the homepage but NOT have that redirect cached.

 

 

Here's my problem. We have a bunch of categories on our site and they get published and non-published constantly. The problem is when the category is not there, it gets redirected correctly, however if that category is then published, users are still getting redirected according to the iRule.

 

 

Our application throws an error page when a page cannot be found or an application error occurs. Our web developers have added to that page a header called "X-Test-Cache-Control" and put in the value "DO-NOT-CACHE" whenever that page is served. My task is to redirect users to the homepage if that page is served BUT not to cache that redirect.

 

 

Here's my iRule so far:

 

 

when HTTP_RESPONSE {

 

if {([HTTP::header X-Test-Cache-Control] eq "DO-NOT-CACHE")} {

 

HTTP::redirect "http://www.siteA.com"

 

}

 

}

 

 

So if I go to http://www.siteA.com/categorytest.htm I will get redirected www.siteA.com if categorytest.htm does not exist. The problem is that if categorytest.htm is there, I will still redirected to www.siteA.com. I would like to know if there is a way I can proxy the redirect to the homepage.

 

 

Thank you!
  • I think I made my problem more confusing then it should be...

     

     

    Basically all I need to do is to create an Irule that will redirect to my homepage when I detect "DO-NOT-CACHE" in the header of the HTTP response. However, that redirect cannot be cached but rather proxied to the origin webservers.

     

     

    I hope that clarifies things...

     

     

    Thanks again...