Forum Discussion
Jan 26, 2017
Modify LTM+APM inactivity timer on one url
Hi,
I have a website behind the APM in LTM+APM mode. The default inactivity timeout is 15 minutes. This should stay 15 minutes for this site except for one url. This is a url to a form which tak...
Stanislas_Piro2
Cumulonimbus
Jan 26, 2017Hi,
to insert a javascript, you can use this irule:
when RULE_INIT {
set static::jscript {}
}
when ACCESS_ACL_ALLOWED {
Disable the stream filter by default
if { [catch {STREAM::disable}] } {log local0. "Stream disable error"}
set insertJscript 0
HTTP::header remove "Accept-Encoding"
set extend_session 0
if {[HTTP::uri] equals /myuri } {set extend_session 1}
}
when HTTP_RESPONSE {
if {$extend_session && ([HTTP::status] == 200) && ([HTTP::header value Content-Type] contains "text")} {
set insertJscript 1
STREAM::expression "@@$static::jscript@"
STREAM::enable
}
if {[HTTP::header exists "Transfer-Encoding"]} {
HTTP::payload rechunk
}
}
when STREAM_MATCHED {
Once we've hit one match, disable the stream filter for the rest of the response
if { $insertJscript} {
log local0. "Session Closed detection : Javascript inserted"
STREAM::disable
}
}
then, add the following script file in APM hosted content with private properties (I do not remember the real keyword):
function detectSessionClosed()
{
var rq = new XMLHttpRequest();
rq.open("GET","/public/share/myjavascript.js",false);
rq.send(null);
if (rq.status === 302) {
window.location.assign("/vdesk/hangup.php3");
}
}
setInterval( detectSessionClosed, 600000);
this script try to download itself every 10 minutes until the user leave the page.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects