Created
October 25, 2019 11:55
-
-
Save mrichman/020ac039ace1c95cb6a409d7ce22e80f to your computer and use it in GitHub Desktop.
Simple HTTPS Server in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
generate server.pem: | |
openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes | |
""" | |
from http.server import HTTPServer, SimpleHTTPRequestHandler | |
import ssl | |
httpd = HTTPServer(("localhost", 5000), SimpleHTTPRequestHandler) | |
httpd.socket = ssl.wrap_socket(httpd.socket, certfile="server.pem", server_side=True) | |
httpd.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment