Deployment issues when using domain.com/path

Hi All,

I have been using Vikunja for a few months now and when I setup a deployment, I usually do it on just the domain or subdomain, such as https://subdomain.example.org

My docker configuration would be like this:

version: '3'

services:
  vikunja:
    image: vikunja/vikunja
    environment:
      VIKUNJA_SERVICE_JWTSECRET: redacted
      VIKUNJA_SERVICE_PUBLICURL: https://subdomain.example.org
      VIKUNJA_DATABASE_TYPE: sqlite
      VIKUNJA_DATABASE_PATH: /db/vikunja.db
    ports:
      - 3456:3456
    volumes:
      - ./files:/app/vikunja/files
      - ./db:/db
    restart: unless-stopped

Nginx conf:

server {
    listen 80;
    server_name subdomain.example.org;

    location / {
        proxy_pass http://localhost:3456;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

server {
    listen 443 ssl;
    server_name subdomain.example.org;

    ssl_certificate /etc/letsencrypt/live/subdomain.example.org/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/subdomain.example.org/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers on;

    location / {
        proxy_pass http://localhost:3456;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

This works great, however I was wanting to setup a path such as: https://example.org/mypath to access vikunja.

My attempt to do this was to update VIKUNJA_SERVICE_PUBLICURL in the docker config and then change the server_name in nginx conf and update the path from location / to location /mypath/. Then restart nginx and the docker instance.

When I do this though, I get a page load on the browser but it is just a white screen. If I inspect the page is it being served by vikunja. The error logs for nginx show this:

[error] 6107#6107: *4 open() "/usr/share/nginx/html/assets/index-5J4JE1t8.css" failed (2: No such file or directory), client: <requesting ip address>, server: example.org, request: "GET /assets/index-5J4JE1t8.css HTTP/1.1", host: "example.org", referrer: "https://example.org/mypath/"

It appears that nginx isn’t passing through the assets location. There is a similar problem with /api (and possibly others?). I tried experimenting with the nginx config, but I ended up with all sorts of 502 and 404 errors when running vikunja, even though it initially appeared to help.

So it got me thinking. Is this domain.tld/path approach even supported? Am I missing a config in the docker yaml?

Any help would be appreciated

Thanks

Check out the docs about this:

Thanks for that. So, it is currently only supported when building from source?

yes, exactly. The problem here are the assets, which do not really support rewriting them based on the domain.

OK got it, thanks for your help.