jupyter / nbdime

Tools for diffing and merging of Jupyter notebooks.
http://nbdime.readthedocs.io
Other
2.68k stars 160 forks source link

Add support for a client request prefix parameter to nbdiff-web #458

Closed ned2 closed 4 years ago

ned2 commented 5 years ago

I'm trying to run nbdiff on AWS Sagemaker (using Jupyter Lab) but running into this blocking problem.

Inside the Sagemaker environment, running an app on a port is automatically made available through a prefix appended to the the request string. So an nbdiff instance running on http://127.0.0.1:44021/difftool would be made externally available at http://PUBLIC_HOST/proxy/44021/difftool. This breaks the app however as it assumes the JavaScript asset nbdime.js is located at /static/nbdime.js when it's actually found at /proxy/44021/static/nbdime.js. The same problem occurs within nbdime.js, where all the api requests assume the api endpoints are found at /api/.

nbdiff-web has the base-url parameter, however this changes the prefix for both URL routes and also client requests, so this doesn't work. It seems like a separate request prefix param is required for when a web host has implicitly set a requests prefix.

minrk commented 5 years ago

A couple questions for context:

  1. are you using jupyter-server-proxy (formerly known as nbserverproxy) to do this forwarding? If so, it mangles forwarded paths, but doesn't have to in the current beta release. Telling nbdime the base url and using the path-preserving proxy url should work. That would mean using e.g. http://PUBLIC_HOST/proxy/absolute/44021/difftool
  2. are you aware of the jupyterlab nbdime and nbserver extensions? I'd recommend using those if you can, since they shouldn't have to deal with this proxy stuff.
ned2 commented 5 years ago

Nope, not using jypyter-server-proxy.

And no, I wasn't aware of those extensions. I'll check them out to see if they help, thanks

On Fri, Mar 1, 2019, 22:41 Min RK notifications@github.com wrote:

A couple questions for context:

  1. are you using jupyter-server-proxy https://github.com/jupyterhub/jupyter-server-proxy (formerly known as nbserverproxy) to do this forwarding? If so, it mangles forwarded paths, but doesn't have to https://github.com/jupyterhub/jupyter-server-proxy/pull/85 in the current beta release. Telling nbdime the base url and using the path-preserving proxy url should work. That would mean using e.g. http://PUBLIC_HOST/proxy/absolute/44021/difftool
  2. are you aware of the jupyterlab nbdime and nbserver extensions? I'd recommend using those if you can, since they shouldn't have to deal with this proxy stuff.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jupyter/nbdime/issues/458#issuecomment-468638381, or mute the thread https://github.com/notifications/unsubscribe-auth/ACs1GMuXmSG9cLPiOOE0iQGkTQ6M2y67ks5vSRHqgaJpZM4bYbPs .

vidartf commented 4 years ago

Closing as answered.

michaelhoarau commented 3 days ago

Hi,

I'm running into a similar issue, but within Dataiku. I'm running a Jupyter Lab server inside a Code Studio on this platform (which basically runs a JupyterLab server in a Kubernetes pod). Inside this environment, a diff-web instance running on http://127.0.0.1:3000/diff would be exposed externally on https://$HOST/code-studios/$PROJECT_ID/$CODE_STUDIO_ID/3000/diff. However, diff assumes the nbdime.js file is located at /static/nbdime.js.

How should I use the base-url option to point diff to the right path? If this is not possible, where in this picture would jupyter-server-proxy fit?

Thanks!