1

I am trying to run a django-channels project locally using https (the app has a facebook login that requires https).

I have followed the instructions for generating a key and certificate using mkcert ( https://github.com/FiloSottile/mkcert ) and have attempted to use the key and certificate by running daphne -e ssl:443:privateKey=localhost+1-key.pem:certKey=localhost+1.pem django_project.asgi:application -p 8000 -b 0.0.0.0

The server seems to be starting OK however when I try to visit https://0.0.0.0:8000 nothing happens and eventually I get a 'took too long to respond' message.

No new output is added to the standard daphne output that appears when I start up the server:

2019-07-16 19:23:27,818 INFO     HTTP/2 support enabled
2019-07-16 19:23:27,818 INFO     Configuring endpoint ssl:8443:privateKey=../sec/localhost+1-key.pem:certKey=../sec/localhost+1.pem
2019-07-16 19:23:27,823 INFO     Listening on TCP address 0.0.0.0:8443
2019-07-16 19:23:27,823 INFO     Configuring endpoint tcp:port=8000:interface=0.0.0.0
2019-07-16 19:23:27,824 INFO     Listening on TCP address 0.0.0.0:8000

Can anyone help with this?

Jonathan Stevens
  • 307
  • 1
  • 3
  • 9

2 Answers2

1

Turns out that setting up the Twisted ssl stuff overrides the port that you're setting up in daphne, so in the example above, the site would be shown on port 443

Jonathan Stevens
  • 307
  • 1
  • 3
  • 9
1

You should map the 8000 host port to port 443 of the container while runnig the server.

 docker run ... -p 8000:443 ...
ouflak
  • 2,458
  • 10
  • 44
  • 49
nepal
  • 11
  • 1