Simple HTTP(S?) server serving WebASM content
Submitted by clemens on Wed, 2021/02/17 - 1:42pm
!!! WIP !!!
I was surprised that running python3 -m http.server
could serve WebASM.
But what about HTTPS? According to https://blog.anvileight.com/posts/simple-python-http-server/ this could be possible using
from http.server import HTTPServer, BaseHTTPRequestHandler
import ssl
httpd = HTTPServer(('localhost', 4443), BaseHTTPRequestHandler)
httpd.socket = ssl.wrap_socket (httpd.socket,
keyfile="path/to/key.pem",
certfile='path/to/cert.pem', server_side=True)
httpd.serve_forever()
using certificate generated with
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365
Python 2
python2 -m SimpleHTTPServer 8000