I am running metabase with docker compose and want to run it behind traefik in a subpath, so that it is running as /reporting.
I was able to successfully use Traefik & subpaths for keycloak & nginx for static assets, but there seems to be something causing issues with metabase doing this.
My traefik labels look like the following, and I've tried a variety of options here:
I've tried variations of setting the app url in the metabase settings to / and /reporting, and both fail.
What is happening is I go to /reporting in a browser, and then I get a blank page with metabase header, and it attempting to go to /app/.... instead of /reporting/app/... for assets.
When using PathPrefix(`/reporting`), all requests to /reporting will be forwarded to your target server, including the path /reporting. So your target server needs to respond to /reporting, are you sure that is happening?
With this line you would just add another /reporting to the path: addprefix.prefix=/reporting
I agree with bluepuma77 that adding the prefix as a middleware does not help in this case (BTW, I'd say it has no effect in your current configuration, because you're defining the middleware with the traefik.http.middlewares.reporting.addprefix.prefix=/reporting label, but you're not assigning it to the router (which would be done with an additional line like traefik.http.routers.reporting.middlewares=reporting).
Metabase runs great with behind Traefik. I use it on a dedicated subdomain, so my suggestion is not tested.
I tried both with and without the addprefix portion, and metabase is still failing. It seems like there's code that's rewriting the metabase url on the metabase side.
Ah good catch, I incorrectly had it at https when it should be http, but the behavior is unchanged (I had set it before to http in past tests as well with no results).
And yes, if I open the port, I can access it fine, but changing it in the dashboard also does not help.
I'm using trafeik 2, my trafeik container looks like the following:
I tried that and set the MB_SITE_URL to the port and /reporting, so http://localhost:8082/reporting and metabase is not running at /reporting but the root, so it does not seem to be listening to that, at least without a proxy in front. I can access it fine at http://localhost:8082, so it isnt using the parameter given.
and seeing this in the js logs:
Warning: the Metabase site URL basename "/reporting/" does not match the actual basename "/".
If you insist using a PathPrefix to access it over Traefik, and it's a pure API, no GUI with links, the you can use stripprefix middleware (doc) to remove reportingwhen the request is forwarded internally.
You can use something like whoami (link) to test if your middlewares are working correctly. See simple Traefik example.
Yeah Ive used middleware and have successfully gotten other services working behind trafeik just fine (keycloak, nginx, and a custom backend for example). I'll probably look at a different reporting tool as a solution. I did create a thread over at metabase but haven't seen a response.