Forum Discussion

Ashish_Gupta_15's avatar
Ashish_Gupta_15
Icon for Nimbostratus rankNimbostratus
Dec 16, 2015

Clear browser cache upon redirect

Use cases :-

 

a) Typically user comes to the VIP A and the request is processed by the back end server. b) If the user does not come to the VIP A with the cookie (exception case), I wanted to redirect the user to a different VIP B.

 

Below is the iRule in VIP A and It does not redirect to the error page. Instead It shows up the cached page from the use case A. If I clear the cache and test the use case B with no cookie, It gets redirected to the error page.

 

How can I resolve this issue without having the user to clear the browser cache manually. when HTTP_REQUEST {

 

If cookie does not exist HTTP::redirect "${static::error_page_url}" } }

 

Thanks, Ashish

 

1 Reply

  • Hi Ashish,

     

    your description mentioned that you want to redirect the user if the cookie is "not" present. But the provided example code is build to redirect if the cookie "is" present? Could that be the tiny glitch that causes the trouble?

     

    HTTP_REQUEST { 
        if { not ( [HTTP::cookie exists $cookie_name] ) } then { 
            HTTP::redirect "${static::error_page_url}" 
        } 
    }

    BTW: To manipulate the caching behavior, you have to make sure that the caching directives from the A.) websites original response are getting stripped/overwritten before sending to the client. Could you provide a captured HTTP-response header for this request to see which header needs to considered? (strip possible cookie information before posting)

     

    Cheers, Kai