Sample Rails App Branch: With SSL
Courtenay : April 20th, 2007
If you’ve ever wondered exactly how to get SSL going with your rails app, look no further. I’ve made a branch of the sample app that contains all the necessary SSL code.
View the code: http://sample.caboo.se/empty_with_ssl/
Subversion: svn://caboo.se/plugins/court3nay/empty_apps/ssl
I’ve included a self-signed certificate .pem file for localhost, and a sample lighttpd config file. So you can start lighttpd and it’ll proxy through to your app running on port 3000, and handle SSL requests as well.
The user controller on edit/update/create, and session controller (all actions) have ssl requirements, and will automatically redirect as required.
I’d love some more sample configs and install instructions for other systems; also, the app needs testing and running on Windows.
13 Responses to “Sample Rails App Branch: With SSL”
Sorry, comments are closed for this article.
April 22nd, 2007 at 10:39 AM
I’m telling you, this application is getting bloated by the minute.
April 22nd, 2007 at 12:42 PM
Good stuff, and even contained in a seperate branch. Thankyou kindly.
April 23rd, 2007 at 03:02 PM
Matthijs Langenberg:
Do I really care about what you think? Give it a rest. Sample app is a good thing and I love it! So please do your ranting somewhere else :-)
April 23rd, 2007 at 06:14 PM
Thanks Courtenay. This resource is a godsend to us Rails newbies. Please keep them coming.
April 24th, 2007 at 04:08 AM
A sample app generator would be nice. Checkboxes for plugins/settings, and piced together on the fly. And some time in the future, managable by a piston-like thingy.
April 30th, 2007 at 10:38 AM
Very sweet. Just one thing, a part of the test/ tree appears to be missing from svn.
April 30th, 2007 at 12:53 PM
nope. it’s using rspec.
April 30th, 2007 at 02:26 PM
Doh. Switching to rspec now. Thanks :)
May 1st, 2007 at 03:04 PM
Looks like the rspec version you are using is old. It throws errors when the rspec gem version and rails plugin don’t match. Do you intend on updating this part of the app?
May 7th, 2007 at 01:16 PM
can’t get emptywithssl running with posgresql. i always get:
FATAL: Ident authentication failed for user “myusernamehere”
however all other rubyonrails apps works just fine with same my installation/efforts.
BTW, the phppgadmin can log in and do things with my database using the same credentials for user “myusernamehere”
this user “myusernamehere” is actually an ubuntu user and i could assume some special interferences here reflected in emptywithssl
any idea what’s going on?
thanks,
Valery.
May 7th, 2007 at 02:50 PM
OK, i see that the “FATAL: Ident authentication failed for user” issue is something that i get with any rubyonrails applications when i try to switch from WEBrick to lighttpd. and bad-bad-bad google says n0th1ng
May 8th, 2007 at 10:25 PM
Lovely.
One slight tweak, however. To create new users you’ll want to add :new to ssl_required in the UsersController.
ssl_required :edit, :update, :create, :new
May 17th, 2007 at 04:58 AM
A little thing in to_xml of user, as it’s not the correct function definition, it does not works with an array of users, it should be
def to_xml(options = {}) super( options.merge(:only => [ :login, :timezone, :lastlogin_at ] )) end