Ruby on Rails redirect_to relative URL -
i have rails 4 app hosted behind cloudflare, flexible ssl option turned on, no ssl between cloudflare , app servers sit behind load balancer.
so happens that, instance when user signs using https , redirect welcome page...
redirect_to :action => :welcome
... or ....
redirect_to "/users/welcome"
... rails throws http header "location: http://www.example.com/users/welcome". breaks session , turns off ssl.
i have tried config.force_ssl browser goes infinite redirect loop.
i cannot switch app ssl because parts of have use http, , there's nothing sensitive on wire justify switching, , have or 60 different websites built on app, buying certificates of them cost small fortune. want cloudflare's ssl because users think "little green lock" means site safe , trustworthy :)
so, there way make rails redirect using relative urls? opposed adding http://www.example.com... in front of each url redirects to?
tia
i've found easy fix when using apache: rewrite 30x headers
http://blog.delouw.ch/2009/10/29/302-redirect-behind-ssl-terminating-proxies/
header edit location ^http://(.*)$ https://$1
this question has answer editing header remove protocol , host, opposed redirecting everything:
how rewrite location response header in proxy setup apache
header edit location "(^http[s]?://)([a-za-z0-9\.\-]+)" ""
Comments
Post a Comment