Rails request.referer not working in internet explorer

cas, ruby-on-rails, ruby-on-rails-3, spree

Solution

IE doesn't send the referer header in certain situations. Microsoft has a support article which covers this.

When linking from one document to another in Internet Explorer 4.0 and later, the Referer header will not be sent when the link is from an HTTPS page to a non-HTTPS page. The Referer header also will not be sent when the link is from a non-HTTP(S) protocol, such as file://, to another page.

Problem

I am working on Spree eCommerce in rails and using CAS for single sign-on. After login using cas i am using request.referer to redirect it on the previous page but its not working for Internet Explorer. In Internet Explorer its redirecting me to home page of my app.

Original source