Forum Discussion

DJ_23086's avatar
DJ_23086
Icon for Altocumulus rankAltocumulus
Mar 04, 2008

Conditional respond/redirect

I'm not sure this is possible, but it sounds doable.

 

 

I have a requirement to implement a ONCE-OFF prompt/page generated by the bigip, after which the user is forwarded on to whichever URL was requested.

 

 

Esentially, user requests site, gets prompt page(only on initial connection), is automatically forwarded to real site after a pause (eg. 5 secs).

 

 

I've tried a couple of HTTP::respond and redirect combinations, but I'm not having any luck.

 

 

Any ideas?

3 Replies

  • Hi,

     

     

    It should be possible. What it needs to do is to generate on the first HTTP_REQUEST (you can use a variable you switch from 0 to 1 after the first request so that you won't use the prompt page again)a custom page in which you'll redirect the user to the same page avec the time is elapsed.

     

     

    The only thing to implement is the response page.

     

     

    Can you show us your tests so that we can tell you if it looks good or not ?

     

     

    Thanks

     

  • hi,

     

     

    you should try something like this:

     

     

    when CLIENT_ACCEPTED {

     

    set respond 0

     

    }

     

     

    when HTTP_REQUEST {

     

    if {$respond eq "0"} {

     

    set respond 1

     

    HTTP::respond 200 content \

     

    "\

     

    \

     

    Blah\

     

    \

     

    \

     

    \

     

    Bigip response page

    \

     

    Redirection in 5 seconds

     

    \

     

    \

     

    "

     

     

    }

     

    }

     

     

    CLIENT_ACCEPTED is triggered when the TCP handshake is done and so process only once

     

     

    For your response code i trusted you ^^

     

     

    this code will make the user have on its first request your prompt page

     

     

    For having the user being redirected after he received the prompt page you'll need to handle this within your web page not with the BIGIP, it won't work

     

     

    When you do the HTTP::respond then consider that everything after like the HTTP::redirect won't happen.

     

     

    You'll need some code like this:

     

     

    CodeAve.com( Timed Redirect on Page Load)

     

     

     

    This page contains an onload command that will redirect the browser

     

     

     

    to Yahoo! ten seconds after the page has loaded

     

     

     

     

     

    Here is an example Click here

     

     

    So it would give something like:

     

     

    when CLIENT_ACCEPTED {

     

    set respond 0

     

    }

     

     

    when HTTP_REQUEST {

     

    if {$respond eq "0"} {

     

    set respond 1

     

    HTTP::respond 200 content \

     

    "\

     

    \

     

    Your message\

     

    If it doesn't work click \

     

    "

     

     

    }

     

    }

     

  • Seems to do the trick! Thanks.

     

     

    Will need some more testing, but looks promising. On another note, is there a variable for the port being requested? If I need to use this for http and https, should i just use a header inspection rule and duplicate the redirection for https?