[Twisted-Python] Serving WSGIResource via SSL endpoint

Piper Masden piper.masden at gmail.com
Thu Aug 14 16:54:24 MDT 2014


Hi Twistedeers!

  I have a twisted plugin that I created to replace the Django dev server
for our devs. It sets up a separate twisted service for serving media, so
we don't need any urls.py tomfoolery in dev. It also sets up an
experimental REST api server which we hope to make javascript requests to
in the near future.

  The core of the code looks like this:

    resource = WSGIResource(reactor, reactor.getThreadPool(), WSGIHandler())
    endpoint = 'tcp:port=8000'
    server = strports.service(endpoint, server.Site(resource))
    server.setServiceParent(application)

  This has worked great for a while. However, we have some views that we
require https on, and so this dev server doesn't allow us to get to those
views at all. I generated a .key file and a .crt file with openssl, and
then cat'd them together to make a pem, and then changed the endpoint to
be...

    endpoint = 'ssl:port=8000:privateKey=/path/to/key.pem'

  Now when I open my browser and type https://localhost:8000, chrome just
hangs. I don't really know how to diagnose this, because I don't really
know anything about SSL (it's all just magic security goodness to me). I
don't necessarily need a direct answer (though it will certainly make me
look good to all the other devs), but maybe some pointers in the right
direction would help.

-Piper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20140814/6222195b/attachment.html>


More information about the Twisted-Python mailing list