Tornado SSL certs
12,096
You are passing the settings to tornado.web.Application() instead of tornado.httpserver.HTTPServer
Try this,
settings = dict(
...
ssl_options = {
"certfile": os.path.join("certs/myserver.crt"),
"keyfile": os.path.join("certs/myserver.key"),
},
...
)
def main():
http_server = tornado.httpserver.HTTPServer(tornado.web.Application(handlers),
ssl_options = {
"certfile": os.path.join("certs/myserver.crt"),
"keyfile": os.path.join("certs/myserver.key"),
})
http_server.listen(443)
tornado.ioloop.IOLoop.instance().start()
Update:
settings = dict(
...
ssl_options = {
"certfile": os.path.join("certs/myserver.crt"),
"keyfile": os.path.join("certs/myserver.key"),
},
...
)
def main():
http_server = tornado.httpserver.HTTPServer(tornado.web.Application(handlers), **settings)
http_server.listen(443)
tornado.ioloop.IOLoop.instance().start()
Author by
Munkhtsogt
Updated on June 04, 2022Comments
-
Munkhtsogt almost 2 years
I have a question about tornado SSL configuration. I wanna handle HTTPS protocol. I also read docs and stackoverflow same issues. I have a SSL certificate & key files. Code looks like
settings = dict( ... ssl_options = { "certfile": os.path.join("certs/myserver.crt"), "keyfile": os.path.join("certs/myserver.key"), }, ... ) def main(): http_server = tornado.httpserver.HTTPServer(tornado.web.Application(handlers, **settings)) http_server.listen(443) tornado.ioloop.IOLoop.instance().start()
After I starting my app. I wanna access from browser https://mydomain.com but it is not working and nothing happened it gives unsuccess request error. What should I do? BTW http://mydomain.com:443 is working.