Jupyter Server Proxy

4.5.0 · active · verified Wed Apr 15

Jupyter Server Proxy is a Jupyter server extension that enables running arbitrary external processes (like RStudio, Shiny Server, Code Server) alongside a Jupyter notebook server and providing authenticated web access to them via proxied paths (e.g., /rstudio). It comes bundled with a JupyterLab extension to launch pre-defined processes. The current version is 4.5.0, and it generally follows a regular release cadence with bug fixes and new features, with major versions indicating potentially breaking changes.

Warnings

Install

Imports

Quickstart

To use jupyter-server-proxy, you typically create a configuration file (e.g., `jupyter_server_config.py`) in your Jupyter config directory (often `~/.jupyter/`). In this file, you define the external processes you want to proxy using the `c.ServerProxy.servers` traitlet. The `command` list specifies how to start the process, with `{port}` being a mandatory placeholder that jupyter-server-proxy replaces with an available port. After configuring and restarting your Jupyter server, the proxied services become accessible via URLs like `<jupyter-url>/proxy/<server-name>/` or through launcher entries in JupyterLab if specified.

import os

# To configure jupyter-server-proxy, create or edit a file like
# ~/.jupyter/jupyter_server_config.py (or another config path)
# Example content for jupyter_server_config.py:
#
# c.ServerProxy.servers = {
#     'my-http-server': {
#         'command': ['python3', '-m', 'http.server', '{port}'],
#         'timeout': 20,
#         'launcher_entry': {
#             'title': 'My HTTP Server',
#             'enabled': True
#         }
#     },
#     'another-app': {
#         'command': ['sh', '-c', 'echo "Hello, {base_url}/proxy/{port}" > /tmp/output.txt && sleep 99999'],
#         'launcher_entry': {
#             'title': 'Another App',
#             'enabled': True
#         }
#     }
# }

print("Jupyter Server Proxy is configured via `jupyter_server_config.py`.")
print("Once configured, restart your Jupyter server.")
print("You can typically access proxied services at a URL like:")
print("  <jupyter-url>/proxy/my-http-server/")
print("Or launch from the JupyterLab Launcher if `launcher_entry` is enabled.")

# Example to demonstrate a command that could be run via the proxy (won't actually start here)
# For a real quickstart, this configuration needs to be placed in a .py config file.
# The '{port}' placeholder is crucial and is replaced by jupyter-server-proxy.
example_command = ['python3', '-m', 'http.server', '{port}']
print(f"\nExample command that can be proxied: {example_command}")

view raw JSON →