Forum Discussion
boneyard
MVP
Dec 10, 2013APM different new session URL
one of these things which has bothered me for a while now. im using different landing URI for different routes through the access policy. but once the user logs off they all end up in the same screen...
Richard__147088
Nimbostratus
Jun 24, 2014Here's my solution. Be gentle. I'm new here ;-) Any sugegstions for improvement are welcome. Setting the cookie via an irule event in the apm policy would be nice, as well as setting the expiration to a long time.
when HTTP_REQUEST {
set static::orig_uri [HTTP::uri]
set static::cookie_name "LandingURI"
set req [HTTP::request]
set reload_page {
Cookie set for future use.
}
switch [HTTP::path] {
"/" {
if { [HTTP::cookie exists $static::cookie_name] } {
log local0. "No URI given, Found cookie. Send Redirect."
set cookie_value [HTTP::cookie value $static::cookie_name]
HTTP::redirect "http://$cookie_value"
}
else {
log local0. "No URI given, no cookie found."
}
}
"/Specific" {
if {!( [HTTP::cookie exists $static::cookie_name] )} {
log local0. "URI /Specific given, Set cookie."
set cookie [format "%s=%s; path=/; domain=%s" $static::cookie_name $static::orig_uri "."]
HTTP::respond 200 content $reload_page "Set-Cookie" $cookie
}
}
default {
if { [HTTP::cookie exists $static::cookie_name] } {
log local0. "Non-existing URI given, found cookie. Send Redirect."
set cookie_value [HTTP::cookie value $static::cookie_name]
HTTP::redirect "http://$cookie_value"
}
else {
log local0. "Non-existing URI given, no cookie found."
}
}
}
}
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