Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been looking all over and either I can't find anything or I can't find anything that works... so here I am.

How can I go about setting up SSL/HTTPS with regards to Mongrel?

Thanks in advance!

share|improve this question

You run it through a real webserver first, like nginx or Apache, which does the SSL work for you, and then passes back a header saying whether or not the connection was made via SSL (only important if you're doing things like redirecting if a needs-to-be-secure page was accessed without SSL).

In theory, I guess you could stick stunnel in front of mongrel and do it that way, but the reasons not to are huge and scary, so just don't.

share|improve this answer
so.... how do you do it? There is a total lack of tutorials on how to do this, and I'm getting frustrated, to say the least. – mmr Feb 3 '10 at 5:26

It should of course be noted that Mongrel simply "doesn't do" SSL itself.

share|improve this answer

I struggled with this for a while. Mongrel prefers 'The Ruby Way' which is different then the Apache way.

Configure Apache HTTP to serve HTTPS traffic. Then proxy the plaintext/HTTP connections on the backend.

  1. Install mod_proxy. I actually had to recompile httpd to include proxy support.

    LoadModule proxy_module modules/

    LoadModule proxy_http_module modules/

    LoadModule proxy_connect_module modules/

  2. Use mod_rewrite's [proxy] parameter to rewrite all traffic to the Mongrel host. My host is a VirtualHost, with a name like ''.

    RewriteRule ^/(.*)$1 [proxy]

  3. Restrict access to the proxy. See

    <Proxy *>
 Order Deny,Allow
 Deny from all
 # Restrict access from my local network
 Allow from 192.168.0

share|improve this answer

Your Answer


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.