APM Cookbook: AutoLaunch SAML Resources
Published Aug 10, 2016
Version 1.0Was this article helpful?
Yep, I haven't written an iRule that does this yet, but that's the first solution that comes to mind (assuming there's a good Referer header to key off) and you're going down the right path. You'd want to remove the session as well. https://clouddocs.f5.com/api/irules/ACCESS__session.html
 
Actually, in your case since you can control the redirect URL, maybe the simplest is to just choose something like /mycustomlogout and redirect them there, and then your iRule can just look for that instead of bothering with the Referer header.
 
Perhaps try this (untested).
 
when HTTP_REQUEST {
if { [HTTP::uri] equals "/mycustomlogout"} {
ACCESS::session remove
HTTP::redirect "https://mywebsite.com"
}
}