Luke
Luke

Reputation: 459

Twisted port 80 requiring manual port 80 and not working

Throws no errors, yet silently there are problems.

When I run the usual server with python

python -m http.server 80

It works fine and I may access the server with localhost or 127.0.0.1, but when I try running a secure twisted server with

twistd -no web --path=. --https=80 --certificate=../cert.pem --privkey=../key.pem

and try to access via a browser with localhost or 127.0.0.1 my browser can't connect and I must use https://localhost:80 or https://127.0.0.1:80 to connect.

Here's the server startup output:

twistd -no web --path=. --https=80 --certificate=../cert.pem --privkey=../key.pem
2016-11-14T17:41:47+1100 [twisted.application.app.AppLogger#info] twistd 16.5.0 (c:\python35\python.exe 3.5.0) starting up.
2016-11-14T17:41:47+1100 [twisted.application.app.AppLogger#info] reactor class: twisted.internet.selectreactor.SelectReactor.
2016-11-14T17:41:47+1100 [-] Site (TLS) starting on 80
2016-11-14T17:41:47+1100 [twisted.web.server.Site#info] Starting factory <twisted.web.server.Site object at 0x03028E50>
2016-11-14T17:41:47+1100 [-] Site starting on 8080

But I also can't get the normal http to server on port 80.

Here is my question now.

1) How can I allow a client to connect without the trailing :80?

Upvotes: 1

Views: 412

Answers (1)

amon
amon

Reputation: 57656

HTTPS defaults to port 443, whereas HTTP defaults to port 80. The two are different protocols. Note that your HTTP server is running on 8080 as per the shown output. Since you are using a non-standard port for HTTPS, you have to specify the port explicitly.

Upvotes: 2

Related Questions