Forum Discussion

k_pawan's avatar
k_pawan
Icon for Nimbostratus rankNimbostratus
Sep 14, 2020

How to Enabled/add pop prior to Persistence timeout expire

Hello Expert, I am wondering if we have any way to write an irule which provide a pop window for users prior to their persistence timeout expire( roughly about 5 or 10 min before that their session is going to expire in xyz min). We have an application configured with 1 hr as cookie persistence value. I dont see any feature in f5 LTM which can achieve this.

 

Please suggest or guide if you think its possible via irule. I am not much familiar with how to write an irules, so would also need a syntax etc as well.

 

thanks

 

1 Reply

  • I was able to use an HTML-type content profile to add a script that uses the browser's idle time out functionality to alert the user at some predetermined time before the persistence cookie will expire. Here are the components:

     

    1. Navigate to Local Traffic > Profiles : Content : HTML and click Create New Profile.
    2. On the General Properties tab on the left, give the profile a name and set Parent Profile to HTML.
    3. Click the Content Settings tab on the left and check the Enable Content Detection box.
    4. Click the HTML Rules tab on the left, then click the arrow at the right of the Create New... pulldown, and select Append HTML.
    5. On the General Properties tab of the Create New HTML Rule popup, give the rule a name. (You can use the same name as the profile name, if you want.)
    6. Click the Match Settings tab on the left, then enter head in the Match Tag Name field.
    7. Click the Action Settings tab on the left, then enter the following code into the HTML to Append field:
    <script>
    //This script will display a pop-up window on the client's browser
    //if their session to the persistent app is idle for 58 minutes.
    //Assumes the virtual server also has a cookie persistence profile
    //with Expiration set to 60 minutes. Adjust as necessary for whatever
    //timeout period you need.
    setTimeout(IdleTooLong, 58 * 60 * 1000); // 58 minutes
    function IdleTooLong() {
        alert('Your persistent session will expire in 2 minutes. Please click OK then refresh the page to continue persisting.'};
    }
    </script>

     

    8. Click OK to create the rule.

    9. Back on the Create New Profile HTML pop-up window, select the rule you just created from the list of Available Rules on the right, and move it to the list of Selected Rules on the left.

    10. Click OK to save the new HTML profile.

    11. Navigate to the virtual server's configuration and, in the Content Rewrite section, use the HTML Profile setting pulldown to select the HTML profile you just created. (Note: The virtual server must also have an HTTP-type profile specified. If the connection is SSL/TLS encrypted you will also need client-SSL and server-SSL profiles to terminate SSL on the BIG-IP system.)

    12. Click Update to save the virtual server's config.

     

    I tested on an unencrypted HTTP application using a very low cookie persistence profile expiration timeout (3 minutes) along with a reduced setTimeout value (2 minutes) in the append script and it seemed to do what I think you are looking to do. Obviously, the client's browser must allow JavaScript and pop-ups.

     

    Another alternative is to have the application itself send the timeout script so that the BIG-IP system is not involved, especially if terminating SSL on the BIG-IP system is not desired.

     

    Hope this helps...