Forum Discussion

Doug_129661's avatar
Doug_129661
Icon for Nimbostratus rankNimbostratus
Oct 15, 2013

How to capture referral on login page

I have a custom login page on F5 that has a hyperlink to an account creation application for users that don't have an account yet. If the user trys to go to a secure resource they are redirected to the F5 login. If they don't have an account, there is a link to send them to user registration. Is there a way to capture the url they were on and redirect them to account registration, so they can be sent back where they were? The registration app will honor the referral if I can get it to the app.

 

TIA

 

4 Replies

  • You mean send them back to the login page after account registration, or to the page that sent them to the login page in the first place?

     

  • Interesting. So I have to assume that account registration also satisfies logon. In that case, depending on how you trigger the redirection to the login page, that redirection must either contain a reference to the sender in the URI, or (sometimes less reliably) you can use the HTTP Referer header. The login page must then dynamically include this collected value in the link to the account registration page. Let's start with the initial login page redirect. How does that happen?

     

  • Okay, let's start with the initial redirect. You have two options: add a query string to the redirect URI, or rely on the HTTP Referer header. I personally prefer the former. You mentioned that the F5 is watching for this page. Does that means there's a VIP that is simply listening for this redirect and then redirects again to a login page, or is the redirect simply to the APM VIP that starts with a login page? In either case, it will be receiving either a URI with a query string, or an HTTP Referer header that indicates where it came from. If going directly to the APM login page, then you can collect the URI (or header) in the ACCESS_SESSION_STARTED event. Example:

     

    Redirect request to APM VIP:

     

    http://login.example.com/?coming_from=app.example.com

    iRule code to collect and save the query string:

     

    when ACCESS_SESSION_STARTED {
        ACCESS::session data set session.custom.comingfrom [URI::query [HTTP::uri] "coming_from"]
    }

    This will put "app.example.com" into the custom session variable. From there, if the user logon is successful, you can redirect to this URL, or dynamically add it as a query string value in the link to the registration site.

     

  • how do I dynamically add the query string to the link?

    If you've collected the query string from the originator into an APM session variable as described above, then your link will just need to call that session variable. Something like this: