Running Metabase Behind Traefik with Subpath

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:

labels:
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- "traefik.http.routers.reporting.priority=100"
- "traefik.http.routers.reporting.rule=PathPrefix(/reporting)"
- "traefik.http.services.reporting.loadbalancer.server.port=3000"
- "traefik.http.middlewares.reporting.addprefix.prefix=/reporting"

And my docker-compose environment for metabase looks like:

  - MB_DB_TYPE=postgres
  - MB_DB_HOST=metabase_db
  - MB_DB_PORT=5432
  - MB_DB_USER=metabase
  - MB_DB_PASS=passwordhere
  - MB_ENCRYPTION_SECRET_KEY=secrethere

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. This seems to be because the javascript is wiping out the url I give it (see https://github.com/metabase/metabase/blob/master/resources/frontend_client/inline_js/index_bootstrap.js#L23).

And I have attempted to follow what it said (it forced the base url to /, when I set it to reporting) and I tried to set to / and also to /reporting, and both gave me the same result.

I ended up switching to grafana instead, as it was easy to setup and supported sub paths much better.

The docker container in compose ended up being:

grafana:
    image: grafana/grafana-oss:9.5.15
    restart: always
    depends_on:
      - grafana_db
    environment:
      GF_DATABASE_TYPE: postgres
      GF_DATABASE_HOST: grafana_db:5432
      GF_DATABASE_NAME: grafana
      GF_DATABASE_USER: grafana
      GF_DATABASE_PASSWORD: passwordhere
      GF_DATABASE_SSL_MODE: disable
      GF_SECURITY_ADMIN_USER: admin
      GF_SECURITY_ADMIN_PASSWORD: passwordhere
      GF_SERVER_SERVE_FROM_SUB_PATH: true
      GF_SERVER_DOMAIN: localhost
      GF_SERVER_ROOT_URL: http://localhost:8088/reporting/
      GF_ENABLE_GZIP: true
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=proxy"
      - "traefik.http.routers.reporting.priority=100"
      - "traefik.http.routers.reporting.rule=PathPrefix(`/reporting`)"
      - "traefik.http.services.reporting.loadbalancer.server.port=3000"
    volumes:
      - ./grafana-data:/var/lib/grafana
      - ./resources/grafana-provisioning:/etc/grafana/provisioning

Thanks, we don’t have a traefik lab ready to provide you a quick solution