Forum: Rails deployment single app with https and http section

Posted by Frantisek Psotka (fero)
on 2009-09-08 10:50
Hello nerds,

I want to discuss approach to this situation: I have one rails app and I
want to make only part of, not whole app, running on https.

I know, that https is question of configuring web server. The only
solution I worked out, is to split app into two, one running with ssl.
But I want to avoid splitting application. It is possible?

Thanks for every reply.
Posted by Ashif Manjur (ashif_manjur)
on 2010-01-04 21:02
Well, you can use :protocol => 'https://' as a parameter value in 
redirect_to call. But be sure it will work only if you are using url as 
hash values. It will not work on relative urls. The best way would be to 
add a before_filter method and decide on your condition and redirect the 
protocol as https://. one example might be like this:

def require_https
    redirect_to :protocol => "https://" unless (request.ssl? or 
local_request? or request.post? or ENV["RAILS_ENV"]=="development")
end

Frantisek Psotka wrote:
> Hello nerds,
> 
> I want to discuss approach to this situation: I have one rails app and I
> want to make only part of, not whole app, running on https.
> 
> I know, that https is question of configuring web server. The only
> solution I worked out, is to split app into two, one running with ssl.
> But I want to avoid splitting application. It is possible?
> 
> Thanks for every reply.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.