jupyter / nbviewer

nbconvert as a web service: Render Jupyter Notebooks as static web pages
https://nbviewer.jupyter.org
Other
2.19k stars 544 forks source link

Validate JUPYTERHUB_SERVICE_URL port number #1038

Closed twalcari closed 1 year ago

twalcari commented 1 year ago

This PR is related to the problem identified in https://github.com/jupyter/docker-stacks/issues/1862 .

When a JUPYTERHUB_SERVICE_URL is received with port number 0 (which is a valid usecase according to @minrk, some mechanism triggers which causes the Jupyter server to start running on port 80 instead of the default port 8888. Even when a JUPYTER_PORT environment variable is set, this value is ignored. I'm not sure where/why this exactly happens.

This seems to be the only place where JUPYTERHUB_SERVICE_URL is parsed. When an invalid port number 0 is received, I think it is best to log a warning and revert to the default port 5000 instead.

minrk commented 1 year ago

pre-commit.ci autofix

minrk commented 1 year ago

Thanks!