Issues serving Panel with Basic Auth from terminal in JupyterHub
I'm on the main branch of Panel. I've been improving the Basic Auth experience in https://github.com/holoviz/panel/pull/5441.
Normally I develop in VS Code on JupyterHub with code server + jupyter-server-proxy installed. So I expect to be able to run
serve script.py --basic-auth my_password --cookie-secret my_super_safe_cookie_secret
VS Code will now proxy the app at /..../vscode/proxy/5006/ and make sure that when I click http://localhost:5006/script in the terminal my browser will open up at /..../vscode/proxy/5006/script.
Ok it seems to work. I'm redirected to
/.../vscode/proxy/5006/login?next=%2F.
(I guess the %F is /. Why its not %Fscript I don't know. Its probably a separate bug?)
When I correctly enter the password I end up at / where I should end up at /.../vscode/proxy/5006/login
Its the same problem with all the redirects to/ from login and logout.
Context
Looking at the implementation in auth.py I can see everything starts with a /.
There is no where that the functionality can see that its not coming from / but /..../vscode/proxy/5006. There is no where I can tell it that.
If we change all redirects to prefix ".", i.e. "/" becomes "./", then it would work (I've tried). But I don't know if this will make other things break.
I can see in the basic_login.html template though that it has been changed to ./login.
Need Guidance
Could I overwrite the redirect function such that it always prepends . @philippjfr
Sadly this isn't straightforward, Tornado will not handle relative redirects correctly so paths should be absolute. It is now possible to provide a --root-path to get this working but I understand that providing a root path in a JupyterHub setup is awkward because it includes the user string.