What is staticpath and interface used for? + Error 405

I have

  interface: ":44106"
  staticpath: "/opt/vikunja/static/frontend/files"

but what does this actually do? (The frontend files - ex index.html are all in /opt/vikunja/static/frontend/files)
It isn’t hosting a webserver on port 44106 - plus I couldn’t find anything in the docs about this

Also, when using nginx, if I try using gzip, it gives this error:

nginx: [emerg] "gzip" directive is duplicate in /etc/nginx/sites-enabled/domain.com.conf:1

and when not using gzip, it gives me an error 405 when trying to create an account, log in, etc
I’m using the default nginx config except for changing the server_name to my domain

The staticpath option allows you to host frontend files with the api. The interface option is used to set the port.

Here’s the docs about this: Config options | Vikunja

Note that you need to nest both options below the service option. If you that’s what you did and it still does not work, did you check the logs?

Sorry, couldn’t respond for a while because the VPS (networking?) was down

But I looked at the logs, and I fixed it by adding a symlink to /usr/bin/vikunja

It seem like it doesn’t use GZIP though, so when trying to setup a nginx reverse proxy, it still gives the error mentioned in the original post.
Here’s my nginx config:

gzip  on;
gzip_disable "msie6";

gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml;

server {
    listen       80;
    server_name  todo.DOMAIN.COM;

    location / {
      proxy_pass http://0.0.0.0:44106;
      proxy_set_header Host $http_host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}

For now, I just turned on gzip, but when trying to go to any URL besides the base URL (ex domain.com/tasks/by/upcoming or domain.com/login), it responds with {"message":"Not Found"}. However, if I press a button that goes to that URL, it works fine (the rest of the website functions fine).
This happens with both nginx and the direct IP:port

How can I fix this?

That should be fixed now, looks like Vikunja was not rewriting requests properly.

Seems to be fixed… partially
Now, nginx reverse proxy is broken (works fine when connecting via a direct IP) with this error:

An error occurred:
Error: Error while refreshing user info:

Please check if the api url is correct.

And also, I made a typo in my message (whoops!), I meant to say “For now, I just turned off gzip” as using the GZIP configuration in the docs still give that error

My nginx configuration

Can you reach /api/v1/info through nginx?

Yes (and it gives the same output as /api/v1/info directly without nginx)

Which API url did you configure in the frontend? Does it work if you put in the full url explicitely?

Also, why are you using the Vikunja api to host the frontend files if you have nginx? Something like this should work: Reverse Proxy | Vikunja

The front end files are default (installed the unstable for both API and frontend)

I disabled the vikunja API hosting the frontend and used the nginx config that’s in the link you sent, but I still get the nginx error:

Jun 07 15:18:11 instance-1 nginx[1376162]: nginx: [emerg] "gzip" directive is duplicate in /etc/nginx/sites-enabled/todo.DOMAIN.com.conf:1
Jun 07 15:18:11 instance-1 nginx[1376162]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jun 07 15:18:11 instance-1 systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE

Here is my nginx config: paste | NK80LzzWtu (pastes.dev)

If I disable GZIP, then now it gets stuck on “Loading”, then errors with:

An error occurred:
AxiosError: Network Error

Please check if the api url is correct.

This is my config.yml: paste | ZJ3ZNb3ltD (pastes.dev)

Okay, then this does not sound like a problem with the staticpath. Which unstable build are you using? There’s been a few fixes in the last few days, one of them might be related to your problem.

I was using a build from 6/7
I just installed the latest API and frontend unstable builds but the same issues above still occur

Can you check with the networking tab of the browsers Dev tool which URLs it tries to connect to?

There are three red logs:
info: https://todo.domain.com/api/v1/info - 502 (from service worker)
⚙ info: https://todo.domain.com/api/v1/info - 502
info: https://todo.domain.com:3456/api/v1/info
Note that I’m using cloudflare, tried with both orange cloud (https) and gray cloud (http)

What’s the response of the request with the 502 status code? What’s in the vikunja logs?

Note: Didn’t notice until now, but the third info only appears after the loading attempt fails
Note 2: Using Microsoft Edge

Vikunja logs:

Jun 07 18:02:34 instance-1 vikunja[1410535]: 2023/06/07 18:02:34 No home directory found, not using config from ~/.conf>
Jun 07 18:02:34 instance-1 vikunja[1410535]: 2023/06/07 18:02:34 Using config file: /opt/vikunja/config.yml
Jun 07 18:02:34 instance-1 vikunja[1410535]: 2023-06-07T18:02:34.172973249-04:00: INFO        ▶ migration/Migrate 051 R>
Jun 07 18:02:34 instance-1 vikunja[1410535]: 2023-06-07T18:02:34.173060089-04:00: INFO        ▶ models/RegisterReminder>
Jun 07 18:02:34 instance-1 vikunja[1410535]: 2023-06-07T18:02:34.173080409-04:00: INFO        ▶ models/RegisterOverdueR>
Jun 07 18:02:34 instance-1 vikunja[1410535]: 2023-06-07T18:02:34.173154849-04:00: INFO        ▶ cmd/func25 054 Vikunja >
Jun 07 18:02:34 instance-1 vikunja[1410535]: ⇨ http server started on [::]:43931

info response: paste | VYhhNSE6It (pastes.dev)
⚙ info response: This request has no response data available (MSEdge message, not the actual response data)
info response: Failed to load response data: No data found for resource with given identifier (MSEdge message, not the actual response data)

Looks like the request never arrives at the Vikunja api. The cloudflare response indicates there’s a problem with your nginx config. Does it work without cloudflare? Is there anything the nginx docs?