# Single app with https and http section

**URL:** <https://www.ruby-forum.com/t/single-app-with-https-and-http-section/175116>\
**Category:** Deployment\
**Created:** [September 8, 2009, 10:50am UTC](https://www.ruby-forum.com/t/single-app-with-https-and-http-section/175116 "2009-09-08T10:50:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fero](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/b2d939/32.png) [@fero](https://www.ruby-forum.com/u/fero)\
**Post date:** [September 8, 2009, 10:50am UTC](https://www.ruby-forum.com/t/single-app-with-https-and-http-section/175116/1 "2009-09-08T10:50:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![fero](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/b2d939/32.png) [@fero](https://www.ruby-forum.com/u/fero)\
**Post date:** [January 4, 2010, 9:02pm UTC](https://www.ruby-forum.com/t/single-app-with-https-and-http-section/175116/2 "2010-01-04T21:02:22Z")

</div>

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 P. 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.
