Welcome to Working With Rails


Discussion Forums

Discuss all things Ruby on Rails with perhaps the web's most vibrant group of Ruby on Rails enthusiasts.
How to implement SSL in development environment that runs on mongrel?
3 Posts
How to implement SSL in development environment that runs on mongrel?

I'd recommend using passenger/apache with self signed certs, that way you can test SSL redirects in development. The very least you should have controller/integration tests or stories covering your HTTPS/HTTP redirects.

what is the reason to for testing ssl in development? i personally think this is best left to server config.

I don't believe Mongrel has the capacity to handle SSL requests; you'll need Apache or Nginx for that. You could deal with the annoyance of running Apache on your development boxes, but you'd need to set up appropriate SSL certificates on each machine, which is simply not worth the hassle.

However, even if you disable SSL in your development environment you can leave it on in your test environment and write functional tests for the behavior you want around SSL. For instance, you could test your FooController with something like this:

describe "#show" do it "should redirect to SSL" do

request.env['HTTPS'] = nil
get :show, :id => @foo.to_param
response.should redirect_to(request.url.sub(/^http/, "https"))

end end

I'd suggest you set up a demo or staging environment to manually test that SSL is working properly. Something like Heroku is great for this.

3 Posts
Login to add your message