panel icon indicating copy to clipboard operation
panel copied to clipboard

Link to own static files in basic login template not working

Open msommer24 opened this issue 3 months ago • 1 comments

ALL software version info

(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc should be added within the dropdown below.)

Software Version Info
panel 1.8.1
bokeh 3.8.0

Python 3.12
Firefox 143
Windows 10

Description of expected behavior and the observed behavior

I use a login page (--basic-login-template) that I have customised slightly (based on /panel/_templates/basic_login.html). I want my own logo to appear on this login page. I have made this available in a static directory and set the link accordingly (--static-dirs assets=./assets). Until recently, this worked perfectly. But now it no longer does. Accessing such a static file now always leads to a redirection to the login page itself. This means that the logo is not displayed.

If access to all static files is completely blocked before logging in, how can I design an appealing login page with my own elements (e.g. logo)?

Complete, minimal, self-contained example code that reproduces the issue

panel serve --port 5013 app_test.py --basic-auth credentials.json --cookie-secret my_super_safe_cookie_secret --basic-login-template resources/test_login.html --logout-template resources/test_logout.html --static-dirs assets=./assets
<h3><img id="logo" src="assets/test-logo.png" width="300" height="200"></h3>

Stack traceback and/or browser JavaScript console output

Screenshots or screencasts of the bug in action

  • [ ] I may be interested in making a pull request to address this

msommer24 avatar Sep 30 '25 06:09 msommer24

Thanks for reporting! The problem is that the static directory endpoints are guarded by the authentication by default. We should have a mechanism to make specific endpoints public by default and I'd be open to suggestions on how best to define this.

philippjfr avatar Oct 29 '25 17:10 philippjfr