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

Fix panel preview rendering on JupyterHub 4.1+ #125

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

krassowski
Copy link
Contributor

@krassowski krassowski commented Jul 30, 2024

Briefly, when running on JupyterHub this PR:

  • loads the panel preview into srcdoc instead by using src as srcdoc is not subject to CSP
  • exposes information about the URL so that Bokeh can adjust the websocket URL accordingly
Before After
Screenshot from 2024-07-29 17-16-06 Screenshot from 2024-07-29 17-29-59
How to test without installing JupyterHub
  1. Install bokeh with Fix rendering on JupyterHub 4.1: respect absolute_url for protocol determination, support data-absolute-url bokeh/bokeh#14003 applied
  2. Run jupyter --paths and choose a writable config path from the config: section, e.g. /home/username/my-env/etc/jupyter
  3. Open (create if needed) a /home/username/my-env/etc/jupyter/jupyter_server_config.py, paste the following:
     c.LabApp.tornado_settings = {
         'hub_prefix': '/hub',
         'hub_host': 'test',
         'user': 'test',
         'headers': {'Content-Security-Policy': "frame-ancestors 'none'"}
     }
  4. Start jupyter lab
  5. Open dev tools Network tab, click on a request and expand Response Headers, verify that CSP for frame ancestors is set to none:
    image
  6. Ensure that page data includes hubPrefix by viewing the source of JupyterLab page
    Screenshot from 2024-07-30 10-06-57
  7. Follow reproduction steps in Panel preview does not work on JupyterHub 4.1+ hosted on a single domain panel#7039

@krassowski

This comment was marked as outdated.

@philippjfr
Copy link
Member

Really appreciated! Will test and then cut a release asap.

@philippjfr philippjfr merged commit 0149ff0 into holoviz:main Jul 30, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panel preview does not work on JupyterHub 4.1+ hosted on a single domain
2 participants