Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a mechanism for URL rewriting before viewing #141

Closed
randomir opened this issue Nov 30, 2022 · 6 comments · Fixed by #143
Closed

Introduce a mechanism for URL rewriting before viewing #141

randomir opened this issue Nov 30, 2022 · 6 comments · Fixed by #143
Labels
feature New feature or request

Comments

@randomir
Copy link
Member

Sometimes the inspector server runs on host A, but is exposed (proxied) as host B, which is then made available to the user (while A might not be).

To support this use case we can introduce a framework of pluggable URL rewriters, similarly to what we do with viewers. A URL rewriter would be called just before the call to view(), or as part of it.

For a motivating example, see #109 (comment).

@jhgoebbert
Copy link

This sounds great.
FYI: With "NGINX -> JupyterHub -> JupyterLab-Server -> jupyter-server-proxy-extension [1] -> DWave inspector" the URL is only known in JavaScript on browser-side and not on server side.

[1] https://jupyter-server-proxy.readthedocs.io/en/latest/arbitrary-ports-hosts.html

@randomir
Copy link
Member Author

randomir commented Dec 6, 2022

Looking at the docs linked seems like the final address can be known server side beforehand. It should be something like the below, no?

<public-base>/<notebook-path>/proxy/<port>

@jhgoebbert
Copy link

No, this is just for direct access to the port.
But in general one wants to write (based on jupyter-server-proxy) a special jupyter-dwave-proxy which would add a launch button on the launch panel like it is documented here:
https://jupyter-server-proxy.readthedocs.io/en/latest/launchers.html#jupyterlab-launcher-extension
Launcher examples:

The URL of a Xpra launched with the launcher-extension https://github.com/FZJ-JSC/jupyter-xprahtml5-proxy would be for example something like:
https://jupyter-jsc.fz-juelich.de/user/jonexample/p98343822a9043cba2fe4a62e735347c/xprahtml5/index.html?username=jovyan&password=90OmXssgt62zy5QI&encryption=AES&key=6j0p7AD6IDj5eZKo&sharing=true

@randomir
Copy link
Member Author

randomir commented Dec 9, 2022

@jhgoebbert, I'm not familiar with your setup, but to render the Inspector inline in a Jupyter notebook, all one needs (if it runs JHub/JLab through reverse proxy) is support for jupyter-server-proxy. We'll add that in #144.

Please correct me if I'm wrong.

@jhgoebbert
Copy link

jhgoebbert commented Dec 9, 2022

@randomir Great, this is fantastic! Thank you for your work and the code update!
We are building our new software stage right now and will try to enable it for all users there. This really makes a big difference.

@randomir
Copy link
Member Author

For usage example, see #144 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants