|# Ported to Python 3 by Telmo "Trooper" (firstname.lastname@example.org)|
|# Original code from:|
|# To generate a certificate use:|
|# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes|
|from http.server import HTTPServer, SimpleHTTPRequestHandler|
|separator = "-" * 80|
|httpd = HTTPServer(("localhost", 4443), SimpleHTTPRequestHandler)|
|httpd.socket = ssl.wrap_socket(httpd.socket, certfile="./server.pem", server_side=True)|
|print("Server running on https://localhost:4443")|
I am trying this on windows 10 and Chrome browser v71.
On the chrome browser, I use "https://localhost:4443" as the URL.
and I get the following error:
I have added the certifcate to Trusted certifcates in the browser, yet this error comes. I guess it has to do with the certificate generation and the "CN" field issued during certificate generation using the openssl
openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
Ok, got it to working by following the certification generation using https://medium.freecodecamp.org/how-to-get-https-working-on-your-local-development-environment-in-5-minutes-7af615770eec. Thanks for the python script.