View Single Post
Ok, to enable SSL in WEBrick, you must get the environment variable USE_SSL set to something ("true" works fine). There are multiple ways to skin this cat, but the simplest in my opinion would be to edit the file script/server and add this line after the first line which specifies the ruby interpreter:

ENV["USE_SSL"] = "true"

So, the file then looks like this:

ENV["USE_SSL"] = "true"
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server'

The reason this works is because environment.rb will dynamically redefine the initialize method for the HTTP server to force SSL as long as ENV["USE_SSL"] evaluates to something.

Note that this will _still_ start WEBrick up on port 3000, and it is not a mixed-mode server, it will only support HTTPS at that point. Also it's using a locally-generated certificate, which your browser may require you to jump through some hoops to trust. Another thing, assuming you are port-forwarding, the host name of your NAT device and the hostname of your OmniFocus box are not likely to be the same. This means your browser will additionally complain about a name mismatch in the cert. You can fix this by changing a line near the end of config/environment.rb:

:SSLCertName => [ [ "CN", WEBrick::Utils::getservername ] ]

Replace the WEBrick::Utils::getservername bit with the DNS of your NAT device and this warning should go away.

If all of that is too complicated, you don't have to do it, just edit script/server as described at the top of this post and you'll probably be fine.


Last edited by jwaldrop; 2007-10-24 at 07:20 PM..