jupyter-server-proxy icon indicating copy to clipboard operation
jupyter-server-proxy copied to clipboard

Proxy a hadoop site in jupyter-lab.

Open ParseDark opened this issue 3 years ago • 2 comments

Bug description

we need to create a jupyter lab extension plugin. Users can access the Hadoop dashboard. These are the background. The Hadoop dashboard we already have a site. So I think should we use the iframe and render in jupyter lab. Everything look good. But I found Hadoop dashboard is an absolute address.

<link href="static/style.css" rel="stylesheet">

And now the proxy will forward my request to http://localhost:8888/style.css

But correctly address should be: http://localhost:8888/proxy/127.0.0.1:4000/style.css

So I will get the 404 No Found Error.

Expected behavior

I want the Hadoop dashboard site don't need to change. And we can proxy all of the site static resources. Actually, we have interim plan that we will change the Hadoop site static folder to another name or change the site static resource address to the relative address. eg:

// For link tag: change the site static name
 <link href="static-file/style.css" rel="stylesheet" />
// For link tag: change the address as relative address
 <link href="./style.css" rel="stylesheet" />

// For script tag: change the site static name
<script src="static-file/index.js"></script>
// For script tag: change the address as relative address
<script src="./index.js"></script>

Actual behaviour

# in iframe html code
<link href="static/style.css" rel="stylesheet">

And now the proxy will forward my request to http://localhost:8888/style.css

But correctly address should be: http://localhost:8888/proxy/127.0.0.1:4000/style.css

So I will get the 404 No Found Error.

How to reproduce

  1. create a localhost site (make sure you use like this address: <link href="static/style.css" rel="stylesheet">)
  2. try to create an iframe widget that includes an iframe
  3. make sure the localhost in the whitelist
  4. run jupyter lab and check out the iframe widget

Your personal set up

  • OS: Mac OS(10.14.6)
  • Version(s): Mac OS(10.14.6)
jupyter core     : 4.7.0
jupyter-notebook : 6.1.6
qtconsole        : not installed
ipython          : 7.16.1
ipykernel        : 5.3.4
jupyter client   : 6.1.7
jupyter lab      : 2.2.6
nbconvert        : 5.6.1
ipywidgets       : 7.6.3
nbformat         : 5.0.8
traitlets        : 4.3.3
jupyter-server-proxy: 1.5.3

jupyter-server-proxy I didn't change anything.

Lastly, thank the jupyter_server_proxy team hard work. Thanks again.

ParseDark avatar Jan 28 '21 03:01 ParseDark

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

welcome[bot] avatar Jan 28 '21 03:01 welcome[bot]

This is not actually a bug. @ParseDark I can suggest to you workaround is change base_url. But this won't help in case of different base_urls.

This would be a nice feature if done.

Randomneo avatar Feb 16 '21 13:02 Randomneo

I didn't follow this clearly, but I think this needs to be refined before being presented to this github repository as a bug. It seems likeley that this isn't a bug with jupyter-server-proxy and if it is, how so must be clarified without the complexity of hadoop discussed.

I'll go for a close, for general help, see discourse.jupyter.org where people can help each other with all forms of issues.

consideRatio avatar Dec 29 '22 12:12 consideRatio