You are here: Forums Ask a Rails expert How to implement SSL in develo...
Posted in Forums : Ask a Rails expert
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> Any help would be appreciated |
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 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. |
|
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. |
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. |
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 )