# Developing with SSL

**URL:** <https://www.ruby-forum.com/t/developing-with-ssl/88586>\
**Category:** Rails\
**Created:** [March 12, 2007, 9:09pm UTC](https://www.ruby-forum.com/t/developing-with-ssl/88586 "2007-03-12T21:09:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [March 12, 2007, 9:09pm UTC](https://www.ruby-forum.com/t/developing-with-ssl/88586/1 "2007-03-12T21:09:37Z")

</div>

I’ve recently modified a site to use SSL for some of the pages, and I  
have it working on the production box. However, in my development  
environment, I’m using RadRails on Windows, which provides a Mongrel  
server for development. Since this setup doesn’t support SSL, I can no  
longer exercise the site fully in my development environment.

Is there a way to support SSL within the RadRails/Mongrel environment?  
I don’t think it uses Apache at all.

I could set up an Apache+Mongrel setup on my dev box to mirror the  
production box setup… is that the way to go? (I was hoping to avoid  
that extra complexity, but maybe I should stop resisting…)

thank,

Michael S.  
[www.mslater.com](http://www.mslater.com)

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [March 12, 2007, 9:44pm UTC](https://www.ruby-forum.com/t/developing-with-ssl/88586/2 "2007-03-12T21:44:41Z")

</div>

I have SSL enabled for production mode, but disabled in development/  
test modes.

# in application.rb

# Force https usage for all links and redirects

# Only do this in production mode, though, because localhost

# probably doesn’t have SSL enabled

if %w(production demo).include?(ENV[‘RAILS\_ENV’])  
def default\_url\_options(options)  
{ :protocol =\> ‘https://’ }  
end  
end

Does this help?

– Wes

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [March 12, 2007, 10:24pm UTC](https://www.ruby-forum.com/t/developing-with-ssl/88586/3 "2007-03-12T22:24:51Z")

</div>

Hi Wes,  
wesgarrison wrote:

> Does this help?

I meant to get back to you sooner and thank you for this after you  
suggested  
it last week. It was exactly what I needed. There’s another approach  
that  
was suggested on the deploy list but it involved changes both in the app  
and  
on the server. I like this better since it puts everything in the app  
and I  
could also extend it to conditionally apply to specific controller /  
actions.

Thanks much. It really helped me.

Best regards,  
Bill
