Error 405 when creating a user

I tried setting up vikunja, but it doesn’t seem quite right. One thing I’m wondering about is whether I should use the same domain for the frontend and api, or not. If not, how should I point the frontend to the right API url?

I’m getting this error when trying to create a user, which probably suggests problems with the links
frontend -> api or api -> db
image

Here’s my composefile:

...
# VIKUNJA
  api:
    container_name: vikunja-api
    image: vikunja/api
    environment:
      VIKUNJA_DATABASE_HOST: vikunja-db
      VIKUNJA_DATABASE_PASSWORD: $VIKUNJA_MYSQL_PASSWORD
      VIKUNJA_DATABASE_TYPE: mysql
      VIKUNJA_DATABASE_USER: vikunja
      VIKUNJA_DATABASE_DATABASE: vikunja
      VIKUNJA_SERVICE_JWTSECRET: $VIKUNJA_SERVICE_JWTSECRET
      VIKUNJA_SERVICE_FRONTENDURL: https://vikunja.$DOMAIN/
    volumes: 
      - $DATA/vikunja/files:/app/vikunja/files
    depends_on:
      - vikunja-db
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.vikunja-api.rule=Host(`vikunja.$DOMAIN`) && PathPrefix(`/api/v1`, `/dav/`, `/.well-known/`)"
      - "traefik.http.routers.vikunja-api.entrypoints=https"
      - "traefik.docker.network=default-network"
    networks:
      - default-network
  frontend:
    container_name: vikunja-frontend
    image: vikunja/frontend
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.vikunja.entrypoints=http"
      - "traefik.http.routers.vikunja.rule=Host(`vikunja.$DOMAIN`)"
      - "traefik.http.middlewares.vikunja-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.vikunja.middlewares=vikunja-https-redirect"
      - "traefik.http.routers.vikunja-secure.entrypoints=https"
      - "traefik.http.routers.vikunja-secure.rule=Host(`vikunja.$DOMAIN`)"
      - "traefik.http.routers.vikunja-secure.tls=true"
      - "traefik.http.routers.vikunja-secure.service=vikunja"
      - "traefik.http.services.vikunja.loadbalancer.server.port=80"
      - "traefik.docker.network=default-network"
    restart: unless-stopped
    networks:
      - default-network
  vikunja-db:
    container_name: vikunja-db
    image: mariadb:10
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    environment:
      MYSQL_ROOT_PASSWORD: $VIKUNJA_MYSQL_ROOT_PASSWORD
      MYSQL_USER: vikunja
      MYSQL_PASSWORD: $VIKUNJA_MYSQL_PASSWORD
      MYSQL_DATABASE: vikunja
    volumes:
      - $DATA/vikunja/db:/var/lib/mysql
    restart: unless-stopped
    command: --max-connections=1000
    networks:
      - default-network

This looks like you did not expose the api via traefik as well. The browser accessing the frontend makes requests to the api so it needs to be accessible from the outside. Check out the traefik examples: Full docker example | Vikunja

Isn’t it exposed through this? It’s a line from the vikunja-api in the composefile.

It should be, yes. Can you access the api at DOMAIN/api/v1/info?

When I go to “/api/v1/info” I just get redirected to the login page “/login”

Then theapi is not properly exposed. Check the traefik logs for error messages, maybe compare your version with the example from the docs: Full docker example | Vikunja