The base url in selenium was https. The button click was firing off an ajax request that wasn't returning the referer. Once the base url was switched to http, the button click worked fine and there was no redirect to the base url.
"If a website is accessed from a HTTP Secure (HTTPS) connection and a link points to anywhere except another secure location, then the referer field is not sent." --https://www.rfc-editor.org/rfc/rfc2616#section-15.1.3