SSL

1 view
Skip to first unread message

Dan

unread,
Jul 11, 2008, 1:27:30 PM7/11/08
to sinatrarb
I"ve just started trying Sinatra out today...

I'm interested in using SSL for specific portions of my site. Is
there a recommended approach?

Thanks.

Blake Mizerany

unread,
Jul 11, 2008, 1:45:56 PM7/11/08
to sina...@googlegroups.com
Use nginx rewrites or:

get '/securestuff' do
  redirect 'https://' + request.host + request.path_info + '?' + request.query_string unless request.scheme == 'https'
end

Is that what you're looking for?
--
Blake Mizerany
blake.m...@gmail.com

Chris Schneider

unread,
Jul 11, 2008, 1:51:35 PM7/11/08
to sina...@googlegroups.com
A few things that you could be going after here:

1) Forcing SSL on certain pages - this is what Blake said, and the key thing is request.scheme == 'https' or 'http', reject or redirect requests as needed.

2) Setting up SSL itself - Sinatra doesn't care how it gets called.  It's really up to the fronting web server to deal with it.  Blake obviously uses nginx, I use lighttpd, and our old friend Apache.  One of them will be dealing with the SSL part, and Sinatra just maps paths to actions.  The middle layer of mongrel or thin don't have anything to do with SSL (afaik), and rely on a more traditional web server to handle it.


Either way, good luck - I think Blake's answer covers most of what you want, and maybe I cleared up a little more.

Let us know if you run into more issues or have more questions.

Chris
Reply all
Reply to author
Forward
0 new messages