jupyterlab-link-share
jupyterlab-link-share copied to clipboard
Support JupyterLab behind a proxy
Is your feature request related to a problem? Please describe.
Using JupyterLab link share does not work behind a proxy. In this case this is Google Cloud AI Vertex Notebooks which use an inverting proxy. JL Version 3.1.18. When you select a Notebook .ipynb file and click Share nothing happens. An exception is thrown in Dev Console.
Describe the solution you'd like
New PR or support https://github.com/jupyterhub/jupyter-server-proxy
Describe alternatives you've considered
N/A
Additional context
- Python package version:
jupyterlab_link_share 0.2.1
- Extension version:
jupyter lab extension list
Config option `kernel_spec_manager_class` not recognized by `ListServerExtensionsApp`.
Config dir: /home/jupyter/.jupyter
/opt/conda/lib/python3.7/site-packages/jupyter_server_mathjax/app.py:40: FutureWarning: The alias `_()` will be deprecated. Use `_i18n()` instead.
help=_("""The MathJax.js configuration file that is to be used."""),
Config dir: /opt/conda/etc/jupyter
beatrix_jupyterlab enabled
- Validating beatrix_jupyterlab...
beatrix_jupyterlab OK
jupyter_server_proxy enabled
- Validating jupyter_server_proxy...
jupyter_server_proxy OK
jupyter_server_mathjax enabled
- Validating jupyter_server_mathjax...
jupyter_server_mathjax OK
jupyterlab enabled
- Validating jupyterlab...
jupyterlab 3.1.18 OK
jupyterlab_git enabled
- Validating jupyterlab_git...
jupyterlab_git 0.33.0 OK
jupyterlab_link_share enabled
- Validating jupyterlab_link_share...
jupyterlab_link_share 0.2.1 OK
jupytext enabled
- Validating jupytext...
jupytext 1.13.0 OK
nbclassic enabled
- Validating nbclassic...
nbclassic OK
nbdime enabled
- Validating nbdime...
nbdime 3.1.0 OK
Config dir: /usr/local/etc/jupyter
url: "https://12fdfa4208b3bba4-dot-us-west1.notebooks.googleusercontent.com/jupyterlab_link_share/servers?1634682993002"
Error
Uncaught (in promise) Error: <!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Jupyter Server</title>
<link id="favicon" rel="shortcut icon" type="image/x-icon" href="/static/favicon.ico?v=50afa725b5de8b00030139d09b38620224d4e7dba47c07ef0e86d4643f30c9bfe6bb7e1a4a1c561aa32834480909a4b6fe7cd1e17f7159330b6b5914bf45a880">
<link rel="stylesheet" href="/static/style/bootstrap.min.css?v=0e8a7fbd6de23ad6b27ab95802a0a0915af6693af612bc304d83af445529ce5d95842309ca3405d10f538d45c8a3a261b8cff78b4bd512dd9effb4109a71d0ab" />
<link rel="stylesheet" href="/static/style/bootstrap-theme.min.css?v=8b2f045cb5b4d5ad346f6e816aa2566829a4f5f2783ec31d80d46a57de8ac0c3d21fe6e53bcd8e1f38ac17fcd06d12088bc9b43e23b5d1da52d10c6b717b22b3" />
<link rel="stylesheet" href="/static/style/index.css?v=30372e3246a801d662cf9e3f9dd656fa192eebde9054a2282449fe43919de9f0ee9b745d7eb49d3b0a5e56357912cc7d776390eddcab9dac85b77bdb17b4bdae" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
/* disable initial hide */
div#header,
div#site {
display: block;
}
</style>
</head>
<body class="" dir="ltr">
<noscript>
<div id='noscript'>
Jupyter Server requires JavaScript.<br>
Please enable it to proceed.
</div>
</noscript>
<div id="header" role="navigation" aria-label="Top Menu">
<div id="header-container" class="container">
<div id="jupyter_server" class="nav navbar-brand"><a href="/lab" title='dashboard'>
<img src='/static/logo/logo.png?v=a2a176ee3cee251ffddf5fa21fe8e43727a9e5f87a06f9c91ad7b776d9e9d3d5e0159c16cc188a3965e00375fb4bc336c16067c688f5040c0c2d4bfdb852a9e4' alt='Jupyter Server' />
</a></div>
</div>
<div class="header-bar"></div>
</div>
<div id="site">
<div class="error">
<h1>404 : Not Found</h1>
<p>You are requesting a page that does not exist!</p>
</div>
</div>
<script type='text/javascript'>
function _remove_token_from_url() {
if (window.location.search.length <= 1) {
return;
}
var search_parameters = window.location.search.slice(1).split('&');
for (var i = 0; i < search_parameters.length; i++) {
if (search_parameters[i].split('=')[0] === 'token') {
// remote token from search parameters
search_parameters.splice(i, 1);
var new_search = '';
if (search_parameters.length) {
new_search = '?' + search_parameters.join('&');
}
var new_url = window.location.origin +
window.location.pathname +
new_search +
window.location.hash;
window.history.replaceState({}, "", new_url);
return;
}
}
}
_remove_token_from_url();
</script>
</body>
</html>
at /lab/extensions/jupyterlab-link-share/static/703.3b1d11c14afe06e2df1d.js?v=3b1d11c14afe06e2df1d:1
at async execute (/lab/extensions/jupyterlab-link-share/static/703.3b1d11c14afe06e2df1d.js?v=3b1d11c14afe06e2df1d:1)
Thanks @gogasca for the report.
In this case this is Google Cloud AI Vertex Notebooks which use an inverting proxy.
Interesting. It could be that they override something in the jupyter server that impacts the list_jupyter_server used here:
https://github.com/jupyterlab-contrib/jupyterlab-link-share/blob/1c71b792fd8dbcc0d7e86c78c57140e7aa2b5e01/jupyterlab_link_share/handlers.py#L7
@jtpio thanks for replying, I'm TL for Notebooks team, user will access a URL to reach the Jupyter Service, URL looks like this https://<random-string-id>-dot-us-west1.notebooks.googleusercontent.com. Example:
https://12fdfa4208b3bba4-dot-us-west1.notebooks.googleusercontent.com
This URL hits a proxy which redirects request to the VM:
User <--> Proxy <---> VM Running Jupyter
This is the current jupyter_notebook_config.py that is used to start Jupyter Service in VM.
c.NotebookApp.open_browser = False
c.ServerApp.token = ""
c.ServerApp.password = ""
c.ServerApp.port = 8080
c.ServerApp.allow_origin_pat = "(^https://8080-dot-[0-9]+-dot-devshell\.appspot\.com$)|(^https://colab\.research\.google\.com$)|((https?://)?[0-9a-z]+-dot-datalab-vm[\-0-9a-z]*.googleusercontent.com)|((https?://)?[0-9a-z]+-dot-[\-0-9a-z]*.notebooks.googleusercontent.com)|((https?://)?[0-9a-z\-]+\.[0-9a-z\-]+\.cloudshell\.dev)|((https?://)ssh\.cloud\.google\.com/devshell)"
c.ServerApp.allow_remote_access = True
c.ServerApp.disable_check_xsrf = False
c.ServerApp.notebook_dir = "/home/jupyter"
@prodonjs FYI
https://github.com/jupyterlab-contrib/jupyterlab-link-share/pull/21 might be related.
Tried latest version 0.2.4 and got the same error:
Uncaught (in promise) Error: <!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Jupyter Server</title>
<link id="favicon" rel="shortcut icon" type="image/x-icon" href="/static/favicon.ico?v=50afa725b5de8b00030139d09b38620224d4e7dba47c07ef0e86d4643f30c9bfe6bb7e1a4a1c561aa32834480909a4b6fe7cd1e17f7159330b6b5914bf45a880">
<link rel="stylesheet" href="/static/style/bootstrap.min.css?v=0e8a7fbd6de23ad6b27ab95802a0a0915af6693af612bc304d83af445529ce5d95842309ca3405d10f538d45c8a3a261b8cff78b4bd512dd9effb4109a71d0ab" />
<link rel="stylesheet" href="/static/style/bootstrap-theme.min.css?v=8b2f045cb5b4d5ad346f6e816aa2566829a4f5f2783ec31d80d46a57de8ac0c3d21fe6e53bcd8e1f38ac17fcd06d12088bc9b43e23b5d1da52d10c6b717b22b3" />
<link rel="stylesheet" href="/static/style/index.css?v=30372e3246a801d662cf9e3f9dd656fa192eebde9054a2282449fe43919de9f0ee9b745d7eb49d3b0a5e56357912cc7d776390eddcab9dac85b77bdb17b4bdae" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
/* disable initial hide */
div#header,
div#site {
display: block;
}
</style>
</head>
<body class="" dir="ltr">
<noscript>
<div id='noscript'>
Jupyter Server requires JavaScript.<br>
Please enable it to proceed.
</div>
</noscript>
<div id="header" role="navigation" aria-label="Top Menu">
<div id="header-container" class="container">
<div id="jupyter_server" class="nav navbar-brand"><a href="/lab" title='dashboard'>
<img src='/static/logo/logo.png?v=a2a176ee3cee251ffddf5fa21fe8e43727a9e5f87a06f9c91ad7b776d9e9d3d5e0159c16cc188a3965e00375fb4bc336c16067c688f5040c0c2d4bfdb852a9e4' alt='Jupyter Server' />
</a></div>
</div>
<div class="header-bar"></div>
</div>
<div id="site">
<div class="error">
<h1>404 : Not Found</h1>
<p>You are requesting a page that does not exist!</p>
</div>
</div>
<script type='text/javascript'>
function _remove_token_from_url() {
if (window.location.search.length <= 1) {
return;
}
var search_parameters = window.location.search.slice(1).split('&');
for (var i = 0; i < search_parameters.length; i++) {
if (search_parameters[i].split('=')[0] === 'token') {
// remote token from search parameters
search_parameters.splice(i, 1);
var new_search = '';
if (search_parameters.length) {
new_search = '?' + search_parameters.join('&');
}
var new_url = window.location.origin +
window.location.pathname +
new_search +
window.location.hash;
window.history.replaceState({}, "", new_url);
return;
}
}
}
_remove_token_from_url();
</script>
</body>
</html>
at /lab/extensions/jupyterlab-link-share/static/703.14142c44f41a8dff22c0.js?v=14142c44f41a8dff22c0:1
at async execute (/lab/extensions/jupyterlab-link-share/static/703.14142c44f41a8dff22c0.js?v=14142c44f41a8dff22c0:1)