Forum Discussion

Fadhil_Marus__T's avatar
Fadhil_Marus__T
Icon for Nimbostratus rankNimbostratus
Dec 09, 2010

landing page

Good day all,

I'm going to create iRule for "landing page", so client when accessing to the network, get the IP address and def gw, and accessing a web page, the F5 will redirect the first attempt to a landing page (F5 as default gateway for client). so when client open browser at the first time (or connect at the first time), for example: www.google.com, F5 will redirect to internal.company.com. After that when user tries again to open www.google.com or other, F5 will not redirect to the landing page, and the real page displayed (www.google.com or other).

We tried to use this irule (based on table wiki):


when HTTP_REQUEST {
    set tbl "connlimit:[IP::client_addr]"
    if { [table keys -subtable $tbl -count] < 1 } {
        log local0. "LANDING $tbl [table keys -subtable $tbl -count]"
        table set -subtable $tbl "landing" "ignored" 180
        HTTP::respond 302 Location "http://internal.company.com"
        log local0. "LANDING $tbl [table keys -subtable $tbl -count]"
        event CLIENT_CLOSED disable
    } else {
    table set -subtable $tbl "landing" "ignored" 180
    set timer [after 1000 -periodic { table lookup -subtable $tbl "landing" }]    
    log local0. "LANDING2 $tbl [table keys -subtable $tbl -count]"
    }
}
when CLIENT_CLOSED {
    after cancel $timer
    log -noname local0. "CLOSED $tbl [table keys -subtable $tbl -count]"
    table delete -subtable $tbl "landing"
}

But still there is some miss redirection. after first attempt, the second attempt and random attempt still redirect to the landing page.

Is there any good iRule for this?

Thanks and best regards,

Fadhil

1 Reply

  • Hi Fadhil,

     

     

    Is this only for HTTP or decrypted HTTPS traffic? If so, can you use cookie insert persistence and then just redirect clients who don't have a persistence cookie to your notice URL? Or you could insert your own session cookie in the iRule. That would probably be more effective and efficient than storing client IP addresses in LTM's session table.

     

     

    Aaron