jupyter / notebook

Jupyter Interactive Notebook
https://jupyter-notebook.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11.75k stars 4.99k forks source link

Notebook with Hadoop YARN webproxy (how to redirect static file serving) #3867

Open oliverhu opened 6 years ago

oliverhu commented 6 years ago

Hey community!

A question related to serving notebook inside Hadoop yarn container. Hadoop YARN has this concept of Web Application Proxy, which to provide a protection against web based attacks.

So we render notebook inside a node say: http://nodeA:12345, the Web Proxy will hide the actual address and serve: http://webproxy:8080/proxy/applicationId/. A request to noteA:12345/static/ will be mapped to http://webproxy:8080/proxy/applicationId/static/. However, notebook seems to hard static file serving path to /static. As a result of that when user queries static resources, we get:

GET http://webproxy:8080/static/tree/js/main.min.js?v=4139e87e4344862dcb29f94ad26c84cd 404 (Not Found) ?proxyapproved=true:131 GET http://webproxy:8080/static/base/images/logo.png?v=641991992878ee24c6f3826e81054a0f 404 (Not Found)

The working path should be http://webproxy:8080/proxy/applicationId/static/tree/js/main.min.js

I'm curious if this is configurable?

oliverhu commented 6 years ago

Tried with --NotebookApp.base_url=/proxy/application_1533079804735_1687/ doesn't work :(

oliverhu commented 6 years ago

Ended up building a reverse proxy server to add the truncated URL path back :(