[Twisted-web] Enforcing SSL for non-SSL requests

Christopher Armstrong radeex at gmail.com
Wed Aug 10 04:26:03 MDT 2005


On 8/10/05, Marek Habersack <grendel at caudium.net> wrote:
> I would love to avoid having to listen on two different ports to handle that,
> so the ideal thing to have would be a ConditionalSSLServer class which would start
> the SSL session if the client started the SSL handshake and would let the
> programmer handle the situation when the incoming connection is a plain one.
> How hard would it be to implement such a thing?

Listening on two different ports is exactly what you should be doing.
The http port is 80, and the https port is 443. So put the
ChildRedirector on your TCPServer on port 80, and your regular site on
an SSLServer on port 443. That way when people go to "http://foo.com/"
they can be redirected to "https://foo.com".

-- 
  Twisted   |  Christopher Armstrong: International Man of Twistery
   Radix    |    -- http://radix.twistedmatrix.com
            |  Release Manager, Twisted Project
  \\\V///   |    -- http://twistedmatrix.com
   |o O|    |  
w----v----w-+



More information about the Twisted-web mailing list