Forum Discussion
Mike_Roe_60070
Nimbostratus
Nov 23, 2010APM irule: remote login page needs referer
Hi all, We have a need to hide all our apps behind a single login application and are using a remote login page in an APM policy to do this. The problem is that this login app needs some way of finding out which of our 500+ sites the request originated from. We were hopeful that we could just use the referer header but, as the firt hop in this process is the F5 VIP that the policy is assigned to the referer shows http://my.app.com/my.policy.
My best (and only) idea is to somehow attach a cookie in when the access session is created but, being a noob all I seem capable of is logging the original referer but I have been unsuccesful creating a cookie with that value in it that the remote login app can use. My attempt is below:
when ACCESS_SESSION_STARTED {
set orig_referer [HTTP::header value Referer]
log local0. "Referer: $orig_referer"
HTTP::cookie insert name "orig_referer_cookie" value $orig_referer path "/"
}
Any help making this one work would be very appreciated.
- hoolio
Cirrostratus
Hi Mike,when ACCESS_SESSION_STARTED { set orig_referer [HTTP::header value Referer] log local0. "Referer: $orig_referer" } when HTTP_RESPONSE { Check if orig_referer is set if { [info exists orig_referer] }{ Insert the cookie in the response HTTP::cookie insert name orig_referer_cookie value $orig_referer path "/" Unset the variable so we only set the cookie once unset orig_referer } }
- Mike_Roe_60070
Nimbostratus
Thanks Aaron! I have tried this and it is still not working as planned so I put a line in the "when HTTP_RESPONSE" section to log the orig_referer variable and it does not seem to be there. Is it possible that the variables set in the "when ACCESS_SESSION_STARTED" cant exist in the "when HTTP_RESPONSE" section? - hoolio
Cirrostratus
That might be true. I haven't played around with APM to know for sure. Maybe someone else can clarify. - Mike_Roe_60070
Nimbostratus
So the access policy refers to a remote login page which in this case is an app. That app needs to know which site you are coming from so that it can display some images and look/feel of that site. then it posts creds back to the access policy and is passed into the correct pool. Basically for the login page to act properly it needs to know that the request originated from www.mydaytonstore.com or www.mycincinnattistore.com and this the only way I can come up with to accomplish it. I had thought of setting it as session datatoo but I cant figure out how to get the session data out of the session and into the login app.?.
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