I've been trying to follow the instructions for using django runserver with ssl through stunnel listed here:
but am having some trouble. I have stunnel and both runservers each running in a virtual environment. Each seems to be working by iteself.
stunnel.pem looks like this :
-----BEGIN RSA PRIVATE KEY-----
(random)
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
(random)
-----END CERTIFICATE-----
dev_https looks like this:
pid=
cert = stunnel/stunnel.pem
sslVersion = SSLv3
foreground = yes
output = stunnel.log
[https]
accept=8443
connect=8001
TIMEOUTclose=1
When I attempt to access
https://127.0.0.1:8443/
here's what happens:
Stunnel, executed with:
stunnel4 dev_https
shows this:
2012.08.23 20:20:58 LOG5[3818:140280034400000]: Service https accepted connection from 127.0.0.1:44302
2012.08.23 20:20:58 LOG5[3818:140280034400000]: connect_blocking: connected 127.0.0.1:8001
2012.08.23 20:20:58 LOG5[3818:140280034400000]: Service https connected remote server from 127.0.0.1:34622
2012.08.23 20:20:58 LOG5[3818:140280034400000]: Connection closed: 187 bytes sent to SSL, 422 bytes sent to socket
The server executed with:
python2.7 manage.py runserver
shows:
(nothing)
The server executed with:
HTTPS=1 python2.7 managpy runserver 8001
shows:
[23/Aug/2012 19:20:58] "GET / HTTP/1.1" 301 0
Finally, the web page request in the browser shows a standard chrome error:
This webpage is not available
The server at 127.0.0.1 can't be found, because the DNS lookup failed.
I'd appreciate any advice on what I can change or what I'm doing wrong. Thank you for your help!
UPDATE I'm now getting this error message:
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 52878)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 582, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/lib/python2.7/dist-packages/django/core/servers/basehttp.py", line 139, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "/usr/lib/python2.7/SocketServer.py", line 638, in __init__
self.handle()
File "/usr/lib/python2.7/wsgiref/simple_server.py", line 116, in handle
self.raw_requestline = self.rfile.readline()
File "/usr/lib/python2.7/socket.py", line 447, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 104] Connection reset by peer
----------------------------------------