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!
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.
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.
Install mod_proxy. I actually had to recompile httpd to include proxy support.
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
Use mod_rewrite's [proxy] parameter to rewrite all traffic to the Mongrel host. My host is a VirtualHost, with a name like 'ruby.example.org'.
RewriteRule ^/(.*) http://127.0.0.1:3000/$1 [proxy]
Restrict access to the proxy. See httpd.apache.org/docs/2.2/mod/mod_proxy.html#access
<Proxy *>
Order Deny,Allow
Deny from all
# Restrict access from my local network
Allow from 192.168.0
</Proxy>