I am trying to proxy JupyterLab via Node js. Everything works fine, but
when I click on create any notebook. the request to
/jupyterLab/api/contents/ is failing.
------------------------------
*Below are a few details:*
Node version - v9.4.0
JupyterLab version -
jupyter core : 4.6.3
jupyter-notebook : 5.7.9
qtconsole : 4.5.4
ipython : 5.8.0
ipykernel : 4.10.1
jupyter client : 5.3.4
jupyter lab : 0.33.12
nbconvert : 5.6.1
ipywidgets : 7.5.1
nbformat : 4.4.0
traitlets : 4.3.3
Using the Express framework. [Ref
https://expressjs.com/en/starter/generator.html ]
NodeJs proxy package - http-proxy-middleware [Ref
https://www.npmjs.com/package/http-proxy-middleware ]
Node application is running at http://localhost:3001/
JupyterLab is running at http://localhost:8889/
------------------------------
*Node Code*
var express = require('express');const { createProxyMiddleware } =
require('http-proxy-middleware');var app = express();
app.use('/jupyterLab/', createProxyMiddleware({
target : "http://localhost:8889/",
ws : true}));
module.exports = app;
*JupyterLab configuration*
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8889
c.NotebookApp.base_url = '/jupyterLab/'
c.NotebookApp.token = ''
c.NotebookApp.notebook_dir = "D:jupyterLab"
c.NotebookApp.allow_origin = '*'
c.NotebookApp.tornado_settings = {
'headers': {
'Content-Security-Policy': "frame-ancestors 'self'
http://127.0.0.1:3001/ http://127.0.0.1:3001/* http://localhost:3001/
http://localhost:3001/*",
}}
*HTML - Method 1*
<!-- Without proxy, it works perfectly fine. But Node isn't involved here.
--><iframe
src = "http://localhost:8889/jupyterLab/"
height = "400px"
width = "100%"></iframe>[![Screenshot -> Without proxy][1]][1]
**HTML - Method 2 ** <- Target.
<!-- With proxy, Works fine, but when we click on Notebook, an API call
happens, which stays in pending state for 2-4 min and then fails. --><iframe
src = "/jupyterLab/"
height = "400px"
width = "100%"></iframe>[![With Proxi - API failing][1]][1]
[STACK OVERFLOW LINK ->
https://stackoverflow.com/questions/62083593/jupyterlab-proxy-from-nodejs-failing-for-a-particular-request
]
--
You received this message because you are subscribed to the Google Groups
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jupyter/afad5e46-bf58-43ca-a012-fbc33ad49827%40googlegroups.com.