So, I am moving the rails (3.0.9) application from one domain to another. Heroku suggests using before_filter in the application controller to make sure everyone ends in the new domain, for example:
before_filter :ensure_domain if Rails.env.production? APP_DOMAIN = 'www.newdomain.com' def ensure_domain if request.env['HTTP_HOST'] != APP_DOMAIN redirect_to "http://#{APP_DOMAIN}", :status => 301 end end
However, on some controller views, I use ssl_requirement , which I believe does the same thing, but forces the ssl protocol.
I'm not so good at handling requests and all this jazz. My question is, will these two create an infinite loop where the SLL is trying to redirect to https and the before filter is trying to return it to http?
How would you solve this problem?
source share