Skip to content

Support SSL Termination #9139

@bryevdv

Description

@bryevdv

Apparently it's fairly trivial to support SSL termination in Tornado, e.g. this works with a self-signed cert:

diff --git a/bokeh/server/server.py b/bokeh/server/server.py
index 04ce230e1..fb8a6e129 100644
--- a/bokeh/server/server.py
+++ b/bokeh/server/server.py
@@ -394,6 +394,10 @@ class Server(BaseServer):
                                        websocket_max_message_size_bytes=opts.websocket_max_message_size,
                                        **kwargs)

+            import ssl
+            context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
+            context.load_cert_chain(certfile="/Users/bryan/tmp/ssl/cert.pem")
+            http_server_kwargs['ssl_options'] = context
             http_server = HTTPServer(tornado_app, **http_server_kwargs)

             http_server.start(opts.num_procs)

Propose to add server opts and corresponding command line args for certfile and (optionally) keyfile.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions