Reputation: 431
I have some sites that connect to my Tornado API that need a ssl and some that do not. Is there a way one Tornado Api can server both ssl and non ssl requests? Any help greatly appreciated.
I have the following code that only works if a site is not a ssl..
app = Application()
app.listen('8000')
tornado.ioloop.IOLoop.current().start()
And I have have this that works only for secure ssl clients ..
app = Application()
app.listen("8080", ssl_options = {
"certfile": os.path.join(lib_dir, "mydomain.crt"),
"keyfile": os.path.join(lib_dir, "mydomain.key"),
})
tornado.ioloop.IOLoop.current().start()
Upvotes: 0
Views: 80
Reputation: 22134
You cannot serve HTTP and HTTPS traffic on the same port. You can call app.listen twice with two different ports to start both SSL and non-SSL servers.
Upvotes: 1