Open ned2 opened 6 years ago
Displaying both URLs might be the best choice, rather than where we are now. We've made several compromises on this feature, to nobody's satisfaction. See #3356, #3605, #3668, and ultimately #3703. This is a tough compromise, and the answer is simply that it is impossible for one URL to be correct, so I made the deliberate choice to force people to think about it, since the right link cannot possibly be known by the notebook application. But picking from two full URLs could definitely be better than forcing people to edit. In some cases (starting server locally), 127.0.0.1 is right, in others (remote server, docker) it doesn't work. In some cases (everything but docker), hostname/public ip is right, in others (everything but docker), it doesn't work.
Yep, can totally see why the various considerations and trade-offs lead to the decision for the current behaviour. I for one put my vote in for printing multiple URLs and allowing the user to select the complete URL (that can be copy and pasted unedited) that is the appropriate one for them.
I, for one, would be slightly happier with the situation if the token could be repeated on a separate line, so that I could copy-paste without being so incredibly precise. I should be able to just double-click it to select. Example:
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://(ab4b89463967 or 127.0.0.1):8888/?token=959cafebf8ebab4ca16ba38068ff673d0453864423cb1c68
This is your token repeated for copypasteability:
959cafebf8ebab4ca16ba38068ff673d0453864423cb1c68
For completeness, if I double click the token in MS-DOS 10, I get this weird string selected:
127.0.0.1):8888/?token=959cafebf8ebab4ca16ba38068ff673d0453864423cb1c68
@minrk Thank you for linking to the other tickets, so that I could start to understand why this is now happening.
The other tickets do mention a new feature to work around this, display_url
and connect_url
, but I don't understand how to use them correctly:
(jupyterlab) [nfultz@spaceaware-compute-01 ~]$ jupyter notebook --version
5.7.4
(jupyterlab) [nfultz@spaceaware-compute-01 ~]$ jupyter lab --version
0.35.3
(jupyterlab) [nfultz@spaceaware-compute-01 ~]$ jupyter lab --ip=0.0.0.0 --display_url=$(hostname)
[W 10:34:53.890 LabApp] Unrecognized alias: '--connect_url=spaceaware-compute-01.ads.isi.edu', it will probably have no effect.
[I 10:34:54.267 LabApp] JupyterLab extension loaded from /nas/home/nfultz/miniconda3/envs/jupyterlab/lib/python3.7/site-packages/jupyterlab
[I 10:34:54.267 LabApp] JupyterLab application directory is /nas/home/nfultz/miniconda3/envs/jupyterlab/share/jupyter/lab
[W 10:34:54.269 LabApp] JupyterLab server extension not enabled, manually loading...
[I 10:34:54.272 LabApp] JupyterLab extension loaded from /nas/home/nfultz/miniconda3/envs/jupyterlab/lib/python3.7/site-packages/jupyterlab
[I 10:34:54.272 LabApp] JupyterLab application directory is /nas/home/nfultz/miniconda3/envs/jupyterlab/share/jupyter/lab
[I 10:34:54.273 LabApp] Serving notebooks from local directory: /nas/home/nfultz
[I 10:34:54.273 LabApp] The Jupyter Notebook is running at:
[I 10:34:54.273 LabApp] http://(spaceaware-compute-01.ads.isi.edu or 127.0.0.1):8888/?token=149d4602ef2fc22e9fcfe472b789705d7806d29f6e60fc83
[I 10:34:54.273 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 10:34:54.276 LabApp] No web browser found: could not locate runnable browser.
[C 10:34:54.276 LabApp]
To access the notebook, open this file in a browser:
file:///run/user/7149/jupyter/nbserver-95555-open.html
Or copy and paste one of these URLs:
http://(spaceaware-compute-01.ads.isi.edu or 127.0.0.1):8888/?token=149d4602ef2fc22e9fcfe472b789705d7806d29f6e60fc83
Thanks for looking in to this.
closed by #4103, which shows each url in full copy-pasteable form:
To access the notebook, open this file in a browser:
file:///Users/benjaminrk/Library/Jupyter/runtime/nbserver-48349-open.html
Or copy and paste one of these URLs:
http://hostname.tld/?token=d15b26a8175fe045782f1e35ca0b02732ebdd16d52854c85
or http://127.0.0.1:8888/?token=d15b26a8175fe045782f1e35ca0b02732ebdd16d52854c85
@nfultz to override the custom display url, set:
jupyter notebook --ip=0.0.0.0 --NotebookApp.custom_display_url=http://hostname.tld
Thanks, I'll upgrade and see if it's fixed.
@minrk Would you please backport #4103 to the version 5.7.x?
When passing the --ip flag (in my case, providing --ip 0.0.0.0 to make the server available on an intranet) to Jupyter notebook, the resulting URL string that is printed to the terminal for copy-pasting into the browser has the following form:
The host part of the URL has the disjunction
(PUBLIC_IP or 127.0.0.1)
which makes the URL invalid and not suitable for copy-pasting, rendering this feature somewhat broken in this context.What about changing the behaviour to produce the following two alternative URLs when the --ip flag is specified: