I'm running a standard Rails 2.3.11 install, with passenger and nginx. I've correctly installed the SSL certificates and they are confirmed to work. However, I only need SSL on two paths example.com/admin and example.com/bookings. I`m not sure how to accomplish this in the nginx.conf file. The rest of the site, including all assets should go over normal http.

Does anyone have any tips on how to achieve this?


You don't do it in your nginx.conf, you do it in your app. Whatever you want to go over HTTPS you make https:// links, and everything else is an http:// link. There are plugins for Rails that'll allow you to declare what pages must be SSL-protected, and redirect if necessary (I've used ssl_requirement in the past, but it's probably this week's hawtness).

If you try to redirect things in your nginx.conf, all that you're going to do is annoy users with "Some content on this page is unencrypted" warnings whenever they access an HTTPS page.

  • That is what I got when I forced a redirect to https in nginx.conf, it did not show the certificate as verified. I had an idea that doing this on server level would be more efficient for some reason, but if there is no real downside to doing it in the rails app I will surely have a look at the gem you mentioned and do some browsing about it. – amunds Jul 21 '11 at 3:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.