docker-alerta: config.json does not respect base_url

Issue Summary When setting BASE_URL to e.g. /alerta, config.json still gets loaded from /


  • OS: Linux

  • API version: 7.4.0

  • Deployment: Docker with Traefik as reverse proxy

  • Database: Postgres

  • Server config from the docker-compose file:

    image: alerta/alerta-web
      - db
      - ./alerta/config.json:/web/config.json
      - DATABASE_URL=postgres://postgres:postgres@db:5432/monitoring
      - AUTH_REQUIRED=True
      - PLUGINS=reject,blackout,normalise,enhance,prometheus
      - USE_PROXYFIX=True
      - BASE_URL=/alerta
    restart: always
          - alerta
    container_name: alerta
      - "namespace=Monitoring"
      - "traefik.backend=alerta"
      #- ";PathPrefix:/alerta, /config.json, /js"
      - ";PathPrefix:/alerta"
      - "traefik.enable=true"
      - "traefik.port=8080"
      - "traefik.passHostHeader=true"

I’ve created two traefik.frontend.rules to test. If I use the one with multiple PathPrefix settings it’s ‘mostly’ working but there are still some issues I haven’t yet fully identified. There are also some javascript files from the /js folder loaded from / instead of the BASE_URL.


{"endpoint": "", "base_path": "/alerta/api" }

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (10 by maintainers)

Most upvoted comments

@satterly yes, those sed replacements only work for assests, so i ended up building alerta-webui with BASE_URL set to “/alerta/”

@Madic- you might need to do something like this

FROM node:lts-alpine as build-stage
RUN wget -O - | tar -xz -C / \
 && cd /alerta-webui-master && echo "BASE_URL=/alerta/" > .env \
 && npm install && npm run build

FROM whatever-you-are-into as production-stage
COPY --from=build-stage /alerta-webui-master/dist /web

i have a similar problem and as far as i can see, when getLocalConfig is called the path for the configuration file gets concatenated to just /config.json because process.env.BASE_URL is hardcoded to /. shouldn’t this be a relative path since no configuration have been loaded yet?

original config.ts

getLocalConfig() {
  const basePath = process.env.BASE_URL
  return this.$http
    .then(response =>
    .catch((error: any) => {

unminified app.f24b8480.js

key: "getLocalConfig",
value: function() {
    var t = "/";
    return this.$http.get("".concat(t, "config.json")).then(function(t) {
    }).catch(function(t) {

test Dockerfile

FROM nginx:stable-alpine

RUN wget -O - | tar -xz -C / \
 && echo '{"endpoint": "http://localhost:8000/alerta/api"}' > /dist/config.json \
 && chown -R nginx. /dist \
 && echo "daemon off;" >> /etc/nginx/nginx.conf \
 && echo "server {listen 8000; location /alerta {index index.html;alias /dist;}}" > /etc/nginx/conf.d/default.conf \
# this is another issue
 && sed -i "s#\(href\|src\|content\)\(=/\)\(js\|css\|fonts\|apple\|favicon\|mstile\)#\1\2alerta/\3#g" /dist/index.html

EXPOSE 8000/tcp
ENTRYPOINT ["nginx"]

Can’t attach the files directly so I’ve packed them in the following zip archive: