Browse the Ruby on Rails Community.

You are here: Forums Ask a Rails expert How to implement SSL in develo...

Replytotopic

How to implement SSL in development environment that runs on mongrel?

Posted in Forums : Ask a Rails expert

 
Www

Authority 87
Posting Rating 2
Sign in to rate this post

I need to use SSL in my current application that is being developed using Ruby On Rails. So I want to test it in my development environment but mongrel gives the following error:

Mon Mar 15 15:43:32 +0530 2010: HTTP parse error, malformed request (127.0.0.1): #<mongrel::httpparsererror: format invalid http>
Mon Mar 15 15:43:32 +0530 2010: REQUEST DATA: ”\200R\001\003\000\0009\000\000\000\020\000\000\210\000\000\207\000\0009\000\0008\000\000\204\000\0005\000\000E\000\000D\000\0003\000\0002\000\000\226\000\000A\000\000\004\000\000\005\000\000/\000\000\026\000\000\023\000\376\377\000\000\ne\006<+N\232A\377S\202��\224��E��”

PARAMS: {}
-

http://www.railsteam.com

Any help would be appreciated

 
Img_7624

Authority 50
Posting Rating 99
Sign in to rate this post

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.

 
1cca05d8866731a685faa86bffbf334c

Authority 62
Posting Rating 69
Sign in to rate this post

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

 
Me

Authority 62
Posting Rating 78
Sign in to rate this post

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.

Replytotopic

Other Recent Topics

Ask a Rails expert : nested application ApplicationController get called intead of children::ApplicationController

Ask a Rails expert : Best way to structure a database for a large/static dataset

Ask a Rails expert : Ruby Developer (ROR) - Scottish based (Remote working from within the UK)

Ask a Rails expert : Above Ground Pool Supplies

Ask a Rails expert : How to get url params in observer or model in Rails 3.1

Ask a Rails expert : What can persuade you to hire Junior Ruby devs with significant PHP experience?

Ask a Rails expert : What industry value does the Ruby or Rails Certification currently have?

Ask a Rails expert : Louis Vuitton Damier Azur Canvas specially sale ( www.salecheaplouisvuitton.com )

Ask a Rails expert : ·How to check errors/puts statements from ruby files which are under cronob

Ask a Rails expert : Louis Vuitton cheap Soft Sided Luggagespecial offer( www.salecheaplouisvuitton.com )

Formatting Help
  • *bold*       _italics_      
    bq. (quotes)
  • "DSC":http://www.dsc.net
  • * or # (lists)
or cancel