Forum Discussion

Chris_Chaloux_1's avatar
Chris_Chaloux_1
Icon for Nimbostratus rankNimbostratus
Dec 08, 2008

Avoiding the loop...

All -

A new question that I'm working on in my mind.

Lets say I have a URL, i.e. www.mysite.com. For various reasons, I want to put up a "temp out of service" page that contains html, CSS, and image references. The html page lives in a location that would read - www.mysite.com/error/, and the assests (the css and image files) live in /error/images. So, for any requests the redirect would serve up:

http://www.mysite.com/error/service.html.

I can get the service.html file to work just fine, but the page then loops on the redirect attemps when fetching the images and CSS.

Is there a way that I can explicitly allow in the rule to serve up only this content and avoid the loop? How are other people doing this without hosting the files on another vip / pool?

I currently have this rule working fine:

when HTTP_REQUEST {  if { ([string tolower [HTTP::host]] equals "mysite.com") and       ([string tolower [HTTP::uri]] ne "/error/service.html") } {    HTTP::redirect "http://mysite.com/error/service.html"  }}

Can I also use the NE clause for the images, and CSS?

Thanks for any suggestions!

Chris

1 Reply

  • Hi Chris,

    Assuming there is no content under /error/ that isn't referenced by the /error/service.html page, you can change your check from 'ne /error/service.html' to 'starts_with /errror/':

     
     when HTTP_REQUEST { 
        if { ([string tolower [HTTP::host]] equals "mysite.com") and not ([string tolower [HTTP::uri]] starts_with "/error/") } { 
           HTTP::redirect "http://mysite.com/error/service.html" 
        } 
     } 
     

    Aaron