mdub / sham_rack

run Rack applications in-process, without a server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't work with HTTPS

austinthecoder opened this issue · comments

I haven't looked into it too thoroughly, but when I setup ShamRack with a domain, say example.com, then hit https://example.com, it still hits example.com (doesn't go through ShamRack).

ShamRack binds handlers to a hostname/port combination, with the port defaulting to 80. To register a handler for an HTTPS URL, you'll want to bind to port 443, e.g.

ShamRack.at("www.greetings.com", 443) do |env|
  ["200 OK", { "Content-type" => "text/plain" }, ["Hello, world!"]]
end

puts open("https://www.greetings.com/").read

Excellent! Thanks so much.