Taiga redirects on 404 with caddy

1. My Caddy version (caddy -version):

0.10.11

2. How I run Caddy:

systemd (service)

a. System environment:

Ubuntu 16.04, systemd

b. Command:

??

c. Service/unit/compose file:

[Unit]
Description=Caddy HTTP/2 web server %I
Documentation=https://caddyserver.com/docs
After=network.target

[Service]
User=www-data
WorkingDirectory=/home/caddy/
LimitNOFILE=8192
Environment=STNORESTART=yes
ExecStart=/usr/local/bin/caddy -agree=true -conf=/home/caddy/webapps/Caddyfile -email info@<redacted>
Restart=on-failure

[Install]
WantedBy=multi-user.target

d. My complete Caddyfile:

taiga.domain.nl {
	rewrite {
                if {path} not_match ^/api
                to {uri} {uri}/ /index.html
        } # Does not show 404 anymore, but redirects to home page now.

        root /home/taiga/taiga-front-dist/dist/
	errors /tmp/caddy_errors_TAIGA.log
	
        proxy /admin 127.0.0.1:8001 {
                header_upstream Host {host}
                header_upstream X-Real-IP {remote}
                header_upstream X-Scheme {scheme}
                header_upstream X-Forwarded-Proto {scheme}
        }


        proxy /api 127.0.0.1:8001 {
                header_upstream Host {host}
                header_upstream X-Real-IP {remote}
		header_upstream X-Scheme {scheme}
                header_upstream X-Forwarded-Proto {scheme}
        }
}
static.taiga.domain.nl {
	root /home/taiga/taiga-back/static/
}
media.taiga.domain.nl {
	root /home/taiga/taiga-back/media/
}

3. The problem I’m having:

Hello,

Not a native English speaker, my apologies for any mistakes.

I’m trying to get caddy to work with taiga (taiga.io) selfhosted, everything works like a charm IF i use the website for navigation. If I paste a direct link it serves a 404. This also happens when I do F5.

EDIT: After implementing the accepted answer below, the page always redirects to the index. So if I click on an activation mail etc, it always redirects to the index (even on F5)

This is the config I’m trying to translate:

https://pastebin.com/raw/haSEzAy6

I put all the info I have into this post, and hope someone will spot my problem here.

Thanks for looking at my post!

4. Error messages and/or full log output:

Please DO NOT REDACT any information except passwords/keys.
No lo

5. What I already tried:

Googling. lot’s of googling. No help, I followed the link below because that’s the only one who has similar problems.

6. Links to relevant resources:

As a first step, I recommend updating to at least v1.0.4. You’re using quite an old version.

I have done so, stil the same problem sadly

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.