Skip to content

Commit 3a49234

Browse files
committed
Merge branch 'master' into fix-typo
2 parents fe4c8d3 + e497958 commit 3a49234

File tree

21 files changed

+283
-742
lines changed

21 files changed

+283
-742
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*.pyc
2+
*.egg-info/
23
docs/_build
34
node_modules

README.rst

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,31 @@
22
Jupyter Server Proxy
33
====================
44

5+
|ReadTheDocs badge| |Travis badge| |PyPI badge| |Conda badge| |NPM badge|
6+
7+
.. |ReadTheDocs badge| image:: https://img.shields.io/readthedocs/jupyter-server-proxy?logo=read-the-docs
8+
:target: https://jupyter-server-proxy.readthedocs.io/
9+
10+
.. |Travis badge| image:: https://img.shields.io/travis/jupyterhub/jupyter-server-proxy/master.svg?logo=travis
11+
:target: https://travis-ci.org/jupyterhub/jupyter-server-proxy
12+
13+
.. |PyPI badge| image:: https://img.shields.io/pypi/v/jupyter-server-proxy.svg?logo=pypi
14+
:target: https://pypi.python.org/pypi/jupyter-server-proxy
15+
16+
.. |Conda badge| image:: https://img.shields.io/conda/vn/conda-forge/jupyter-server-proxy?logo=conda-forge
17+
:target: https://anaconda.org/conda-forge/jupyter-server-proxy
18+
19+
.. |NPM badge| image:: https://img.shields.io/npm/v/@jupyterlab/server-proxy.svg?logo=npm
20+
:target: https://www.npmjs.com/package/@jupyterlab/server-proxy
21+
522
Jupyter Server Proxy lets you run arbitrary external processes (such
623
as RStudio, Shiny Server, syncthing, PostgreSQL, etc) alongside your
724
notebook, and provide authenticated web access to them.
825

9-
**Note:** This project used to be called **nbserverproxy**. if you have an older
10-
version of nbserverproxy installed, remember to uninstall it before install
11-
jupyter-server-proxy - otherwise they may conflict
26+
**Note:** This project used to be called **nbserverproxy**. As
27+
nbserverproxy is an older version of jupyter-server-proxy, uninstall
28+
nbserverproxy before installing jupyter-server-proxy to avoid
29+
conflicts.
1230

1331
The primary use cases are:
1432

@@ -32,18 +50,26 @@ Install
3250
pip
3351
---
3452

35-
``pip install jupyter-server-proxy``
53+
.. code-block::
54+
55+
pip install jupyter-server-proxy
3656
3757
conda
3858
-----
3959

40-
``conda install jupyter-server-proxy -c conda-forge``
60+
.. code-block::
61+
62+
conda install jupyter-server-proxy -c conda-forge
4163
4264
src
4365
---
4466

45-
``pip install .``
67+
.. code-block::
68+
69+
pip install .
4670
4771
**Note:** if installing from source in editable mode: ``setup.py develop/pip install -e``, please explicitly install the server extensions:
4872

49-
``jupyter serverextension enable --sys-prefix jupyter_server_proxy``
73+
.. code-block::
74+
75+
jupyter serverextension enable --sys-prefix jupyter_server_proxy
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## code-server-traitlet
2+
3+
Create a code-server launcher [via traitlet](https://jupyter-server-proxy.readthedocs.io/en/latest/server-process.html#specifying-config-via-traitlets).
4+
5+
Via https://github.com/betatim/vscode-binder.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
c.ServerProxy.servers = {
2+
'code-server': {
3+
'command': [
4+
'code-server',
5+
'--no-auth',
6+
'--disable-telemetry',
7+
'--allow-http',
8+
'--port={port}'
9+
],
10+
'timeout': 20,
11+
'launcher_entry': {
12+
'title': 'VS Code'
13+
}
14+
}
15+
}

contrib/template/{{cookiecutter.project_name}}/jupyter_{{cookiecutter.project_name}}_proxy/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ def setup_{{cookiecutter.project_name}}():
1212
'environment': {},
1313
'launcher_entry': {
1414
'title': '{{cookiecutter.project_name}}',
15-
'icon_url': os.path.join(os.path.dirname(os.path.abspath(__file__)), 'icons', '{{cookiecutter.project_name}}.svg')
15+
'icon_path': os.path.join(os.path.dirname(os.path.abspath(__file__)), 'icons', '{{cookiecutter.project_name}}.svg')
1616
}
17-
}
17+
}

docs/arbitrary-ports.rst renamed to docs/arbitrary-ports-hosts.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. _arbitrary-ports:
22

3-
=========================
4-
Accessing Arbitrary Ports
5-
=========================
3+
==================================
4+
Accessing Arbitrary Ports or Hosts
5+
==================================
66

77
If you already have a server running on localhost listening on
88
a port, you can access it through the notebook at
@@ -15,6 +15,11 @@ URL in the request.
1515

1616
This works for all ports listening on the local machine.
1717

18+
You can also specify arbitrary hosts in order to proxy traffic from
19+
another machine on the network ``<notebook-base>/proxy/<host>:<port>``.
20+
21+
For security reasons the host must match an entry in the whitelist in your configuration.
22+
1823
With JupyterHub
1924
===============
2025

@@ -38,7 +43,7 @@ Without JupyterHub
3843
==================
3944

4045
A very similar set up works when you don't use JupyterHub. You
41-
can construct the URL with ``<notebook-url>/proxy/<port>``.
46+
can construct the URL with ``<notebook-url>/proxy/<port>``.
4247

4348
If your notebook url is ``http://localhost:8888`` and you have
4449
a process running listening on port 8080, you can access it with

docs/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The primary use cases are:
2020
#. Allow access from frontend javascript (in classic notebook or
2121
JupyterLab extensions) to access web APIs of other processes
2222
running locally in a safe manner. This is used by the `JupyterLab
23-
extension <https://github.com/dask/dask-labextension>`_ for
23+
extension <https://github.com/dask/dask-labextension>`_ for
2424
`dask <https://dask.org/>`_.
2525

2626

@@ -33,7 +33,7 @@ Contents
3333
install
3434
server-process
3535
launchers
36-
arbitrary-ports
36+
arbitrary-ports-hosts
3737

3838

3939
Convenience packages for popular applications

docs/launchers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ to provide launcher icons for registered server processes.
2626

2727
.. code:: bash
2828
29-
jupyter labextension install jupyterlab-server-proxy
29+
jupyter labextension install @jupyterlab/server-proxy
3030
3131
This should provide icons for each registered process in the main
3232
JupyterLab launcher

docs/server-process.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ pairs.
9090
automatically select an unused port.
9191

9292

93+
#. **mappath**
94+
95+
Map request paths to proxied paths.
96+
Either a dictionary of request paths to proxied paths,
97+
or a callable that takes parameter ``path`` and returns the proxied path.
98+
99+
93100
#. **launcher_entry**
94101

95102
A dictionary with options on if / how an entry in the classic Jupyter Notebook
@@ -167,7 +174,7 @@ the command is started
167174
Specifying config via traitlets
168175
===============================
169176

170-
[Traitlets](https://traitlets.readthedocs.io/) are the configuration
177+
`Traitlets <https://traitlets.readthedocs.io/>`_ are the configuration
171178
mechanism used by Jupyter Notebook. It can take config in Python
172179
and we can use that to specify Server Processes - including functions
173180
if we want tighter control over what process is spawned.

jupyter_server_proxy/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def load_jupyter_server_extension(nbapp):
2929
nbapp.web_app.add_handlers('.*', server_handlers)
3030

3131
# Set up default handler
32-
setup_handlers(nbapp.web_app)
32+
setup_handlers(nbapp.web_app, serverproxy.host_whitelist)
3333

3434
launcher_entries = []
3535
icons = {}
@@ -40,4 +40,4 @@ def load_jupyter_server_extension(nbapp):
4040
nbapp.web_app.add_handlers('.*', [
4141
(ujoin(base_url, 'server-proxy/servers-info'), ServersInfoHandler, {'server_processes': server_proccesses}),
4242
(ujoin(base_url, 'server-proxy/icon/(.*)'), IconHandler, {'icons': icons})
43-
])
43+
])

0 commit comments

Comments
 (0)