Edit this page | Blame

Nginx forwarding error regarding static assets

When nginx forwards the following jupyter notebook url:

`http://localhost/58955/41634c46e4c1ef94b02b646509ae8a7bb023bb4ac7926faa`

I get the following error (see nginx question in notebooks/user-stories):

127.0.0.1 - - [20/Sep/2021 00:36:06] "POST / HTTP/1.1" 408 -
[W 04:46:28.035 NotebookApp] 404 GET /41634c46e4c1ef94b02b646509ae8a7bb023bb4ac7926faa (127.0.0.1) 39.990000ms referer=None
[W 04:46:28.081 NotebookApp] 404 GET /static/components/jquery-ui/themes/smoothness/jquery-ui.min.css (127.0.0.1) 2.160000ms referer=http://localhost/58955/41634c46e4c1ef94b02b646509ae8a7bb023bb4ac7926faa
[W 04:46:28.085 NotebookApp] 404 GET /static/components/jquery-typeahead/dist/jquery.typeahead.min.css (127.0.0.1) 2.870000ms referer=http://localhost/58955/41634c46e4c1ef94b02b646509ae8a7bb023bb4ac7926faa
[W 04:46:28.096 NotebookApp] 404 GET /static/style/style.min.css (127.0.0.1) 3.950000ms referer=http://localhost/58955/41634c46e4c1ef94b02b646509ae8a7bb023bb4ac7926faa
[W 04:46:28.099 NotebookApp] 404 GET /static/components/react/react.production.min.js (127.0.0.1) 5.350000ms referer=http://localhost/58955/41634c46e4c1ef94b02b646509ae8a7bb023bb4ac7926faa
[W 04:46:28.106 NotebookApp] 404 GET /custom/custom.css (127.0.0.1) 4.930000ms referer=http://localhost/58955/41634c46e4c1ef94b02b646509ae8a7bb023bb4ac7926faa
[W 04:46:28.108 NotebookApp] 404 GET /static/components/es6-promise/promise.min.js (127.0.0.1) 6.110000ms referer=http://localhost/58955/41634c46e4c1ef94b02b646509ae8a7bb023bb4ac7926faa
[W 04:46:28.110 NotebookApp] 404 GET /static/components/react/react-dom.production.min.js (127.0.0.1) 7.130000ms referer=http://localhost/58955/41634c46e4c1ef94b02b646509ae8a7bb023bb4ac7926faa
[W 04:46:28.113 NotebookApp] 404 GET /static/components/create-react-class/index.js (127.0.0.1) 8.800000ms referer=http://localhost/58955/41634c46e4c1ef94b02b646509ae8a7bb023bb4ac7926faa
[W 04:46:28.118 NotebookApp] 404 GET /static/components/requirejs/require.js (127.0.0.1) 3.320000ms referer=http://localhost/58955/41634c46e4c1ef94b02b646509ae8a7bb023bb4ac7926faa
[W 04:46:28.122 NotebookApp] 404 GET /static/components/react/react.production.min.js (127.0.0.1) 2.700000ms referer=http://localhost/58955/41634c46e4c1ef94b02b646509ae8a7bb023bb4ac7926faa
[W 04:46:28.126 NotebookApp] 404 GET /static/base/images/logo.png (127.0.0.1) 2.450000ms referer=http://localhost/58955/41634c46e4c1ef94b02b646509ae8a7bb023bb4ac7926faa
[W 04:46:28.129 NotebookApp] 404 GET /static/components/react/react-dom.production.min.js (127.0.0.1) 1.860000ms referer=http://localhost/58955/41634c46e4c1ef94b02b646509ae8a7bb023bb4ac7926faa
[W 04:46:28.135 NotebookApp] 404 GET /static/components/create-react-class/index.js (127.0.0.1) 1.520000ms referer=http://localhost/58955/41634c46e4c1ef94b02b646509ae8a7bb023bb4ac7926faa
[W 04:46:28.141 NotebookApp] 404 GET /static/components/requirejs/require.js (127.0.0.1) 2.180000ms referer=http://localhost/58955/41634c46e4c1ef94b02b646509ae8a7bb023bb4ac7926faa
[W 04:46:28.181 NotebookApp] 404 GET /static/base/images/favicon.ico (127.0.0.1) 2.610000ms referer=http://localhost/58955/41634c46e4c1ef94b02b646509ae8a7bb023bb4ac7926faa

See https://git.genenetwork.org/jgart/binderlite/commit/311b85b089e059303041eb2db71d0b1947fe4482

When we paste the token in it allows us to use the notebook successfully Then it remembers the cookie and it works in the future.

But if we try a different browser or if we clear cookies in the devtools panel (firefox -> storage) then, that cookie will not be saved and we run into the same issue.

The nginx config now forwards correctly with the new regex and proper proxy_redirect. The new issue is the token having to be manually inputted into the form. Subsequent nginx forwards successfully forward the port/url link without an issue.

Example token accepted by nginx regex:

http://localhost/49761/?token=f6269bbf48ee5c9887732f5bc76d32f37e1f25483195ae88

The next step is to get jupyter to accept the generated token on the first request without needing to input it manually first.


(made with skribilo)