Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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