Nginx SWAG (LSIO) Configuration

I use SWAG for my reverse proxy and mostly LSIO containers. LSIO doesn’t have a proxy example for Vikunja and I’ve been trying to look at the vikunja documentation and LSIO templates to try to make something work. In my docker-compose for Vikunja I assume I have to add ports to both the frontend and API which would correspond to the ports of 80 and 3456. I’ve been messing around with it for awhile and just can’t get things to work I get 502s from my proxy and when I pull up the local host in the web I am getting 404s and 405s when trying to log in.
Has anyone had luck getting these to work together?

While I don’t know SWAG or LSIO, you could try using this example config and pointing your SWAG proxy to the proxy container on port 80 from that docker-compose example. Probably not a very clean solution, but it should get you a working Vikunja installation.

I was looking at that and I did have a working local host but I wanted to make it internet accessible. I did solve the bad gateway error by setting things up like this:

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name vikunja.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 20;

    location / {

        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app vikunja;
        set $upstream_port 80;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

    }

     location ~ (/vikunja_api)?/api {
         include /config/nginx/proxy.conf;
         include /config/nginx/resolver.conf;
         set $upstream_app vikunja_api;
         set $upstream_port 80;
         set $upstream_proto http;
         proxy_pass $upstream_proto://$upstream_app:$upstream_port;
    
     }
}

I can get to the login page but can’t log in or register. Throws 413 errors which I don’t see in the error code section of the documentation. When I tail the logs I don’t see anything that stands out. I can’t hit the api page either so this still needs some tinkering.
My compose file looks like this:

version: '3'

services:
  db:
    image: mariadb:10
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    environment:
      MYSQL_ROOT_PASSWORD: supersecret
      MYSQL_USER: vikunja
      MYSQL_PASSWORD: secret
      MYSQL_DATABASE: vikunja
    volumes:
      - ./db:/var/lib/mysql
    restart: unless-stopped
  api:
    image: vikunja/api
    container_name: vikunja_api
    environment:
      VIKUNJA_DATABASE_HOST: db
      VIKUNJA_DATABASE_PASSWORD: secret
      VIKUNJA_DATABASE_TYPE: mysql
      VIKUNJA_DATABASE_USER: vikunja
      VIKUNJA_DATABASE_DATABASE: vikunja
#      VIKUNJA_SERVICE_ENABLEREGISTRATION: "True" 
      VIKUNJA_SERVICE_TIMEZONE: America/Chicago
    volumes: 
      - ./files:/app/vikunja/files
    ports:
      - 8095:3456
    depends_on:
      - db
    restart: unless-stopped
  frontend:
    image: vikunja/frontend
    container_name: vikunja
    restart: unless-stopped
    ports:
      - 8094:80
networks:
  default:
    external:
      name: rastacalavera_default

Have you tried putting the nginx example from the docs behind your SWAG proxy?

What’s the response from the server? (Check with your browser’s devtools)

Do you mean put that text in the LSIO proxy config or run a nginx container in the Vikunja compose and point the lsio proxy at that?

The latter. I think it would make things easier, even though adding another container.

I don’t mind having multiple containers.
so I added the following back into my compose file:

  proxy:
    image: nginx
    container_name: vikunja
    ports:
      - 8094:80
    volumes:
      - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
    depends_on:
      - api
      - frontend
    restart: unless-stopped

Then in the LSIO NGINX config I modified it as follows:

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name vikunja.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;


    location / {

        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app vikunja;
        set $upstream_port 80;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

    }

}

When I visit my subdomain, i still can’t log in or register and get 413 errors. Not sure what to look for in fire fox in terms of errors, but when I visit the local IP, something like 10.0.1.2:8094 I can log in just fine.

I figured out how to get errors from the browser! Here is what I found:

The resource at “https://MYCUSTOMDOMAIN.COM/fonts/quicksand-v7-latin-700.woff2” preloaded with link preload was not used within a few seconds. Make sure all attributes of the preload tag are set correctly.

Does that help with trouble shooting at all? If it is a character issue with the db, this is what is in my compose file:

services:
  db:
    image: mariadb:10
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci

It still works just fine when I login using the full URL from the local host.
Error from local IP login:
The resource at “http://192.168.0.XXXX:8094/fonts/quicksand-v7-latin-300.woff2” preloaded with link preload was not used within a few seconds. Make sure all attributes of the preload tag are set correctly.

Is there a base url requirement or something for the compose file when an external url is used?

Error 413 is request entity too large. You won’t find it in the docs because Vikunja does not use it. I’m guessing your LSIO nginx proxy is throwing these. That would match that you can’t seem to access Vikunja through that proxy but can access it just fine with the ip directly.

Is there anything in the logs of the LSIO nginx proxy?

Not an issue with your setup. That’s a frontend issue related to a browser font the frontend uses - you can ignore it, that’s something I need to fix in the frontend directly.

I was able to fix 413 errors by setting max client body size to 0 (disabled).

Then other than that I believe I had your original proxy-conf file