Forum: Rails deployment single app with https and http section

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9650515c4c5d1bd8680195d6f5d072e8?d=identicon&s=25 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.
D91de5cd48aa5538eec321f7a0934a4d?d=identicon&s=25 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.
This topic is locked and can not be replied to.