Membership protected content page dynamic redirect

I have a login form that appears on the protected content page. Is it possible to have the login form redirect to the page that the member was requesting when the protected content page shows up? I don't see a way to modify the redirect URL dynamically. Please let me know I'm missing something. $_SERVER['HTTP_REFERRER'] is blank as is wp_get_referer() for the login form shortcode I've created. I'd hate to rewrite the function because I don't want it overwritten on an update.