I am trying to deploy a panel app under nginx, but the app doesn’t seem to want to use a CDN
Example output on the browser console:
GET
http://(myhost)/static/extensions/panel/bundled/datatabulator/tabulator-tables@5.4.4/dist/css/tabulator_bootstrap4.min.css
Status
404
Not Found
VersionHTTP/1.1
Transferred183 B (22 B size)
Referrer Policystrict-origin-when-cross-origin
DNS ResolutionSystem
OK, so I’ve done some more problem investigation and found the “static_url” argument to pn.serve
By setting that, I got nginx to send most of the requests down to the right application to get the javascript out of the panel-app’s virtual environment, but there seem to be a few places where the panel app is requesting javascript without honoring the static_url setting:
A whole bunch of bokeh requests: /static/js/bokeh-XXX files plus one panel javascript file: http://(my-host)/static/extensions/panel/panel.min.js?v=20d2cb096d1ab41a4140246d12f07bf6b8cb743fd48122b72532c03d44c5c14a
So, I have an nginx server that serves as the proxy-server for all the web-apps for my team. It currently hosts a flask app, a FastAPI app, and now this new panel app.
My original thought was that if the javascript data comes from a cdn, then my nginx server doesn’t have to keep track of different versions of everything for each app: All three apps are on different versions of bokeh, for example. The general plan is for Panel to become more of a team standard, and I’d want each app to get the right versions of everything as all the apps get updated at different rates and maybe want different versions of things.
It turns out that the second message I posted where I thought static_url was helping is not true: I actually had forced the nginx server to temporarily serve /static/panel stuff out of the panel app’s virtual environment (which was safe because this is the only panel app at the moment, even if that’s not true in the future).
I don’t know how to make a “minimum reproducible test case” when there’s an nginx server involved. But, if I can make the panel app get it’s static data from an URL that I can put in a “location” block in nginx (so /this-particular-app/static" rather than just “/static”, I think that would work rather than getting via CDN.
If your nginx configuration is only serving one panel app, you could configure nginx to try to serve the /static files out of the panel app’s virtual environment.
The complications above come from having one nginx instance that serves multiple applications. It’s much easier to configure the serving up all the panel javascript if each app’s files are clearly denoted by the extra prefix.