Noob to Caddy, receiving 404 error on sub paths

1. The problem I’m having:

I am a noob with Caddy. I am attempting to have Caddy serve a static Vue app. When I issue a request to everything works correctly. However if I issue a request with any sub pages, for example, the server returns a 404 error.

What needs to be changed to eliminate the 404 error?

2. Error messages and/or full log output:

The server returns a 404 error when any sub pages are included in the request

3. Caddy version:


4. How I installed and ran Caddy:

> sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
> curl -1sLf '' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
> curl -1sLf '' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
> sudo apt update
> sudo apt install caddy

a. System environment:

Ubuntu 22.04.4 LTS

b. Command:

sudo systemctl start caddy

c. Service/unit/compose file:

# caddy.service
# For using Caddy with a config file.
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
# See for instructions.
# WARNING: This service does not use the --resume flag, so if you
# use the API to make changes, they will be overwritten by the
# Caddyfile next time the service is restarted. If you intend to
# use Caddy's API to configure it, add the --resume flag to the
# `caddy run` command or use the caddy-api.service file instead.


ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile --force


d. My complete Caddy config: {
root * /home/ubuntu/FiddleShows/
    log {
		output file /var/log/caddy/access.log

5. Links to relevant resources:

See Common Caddyfile Patterns — Caddy Documentation, you probably need try_files to have Caddy rewrite requests to unknown files to your index.

You shouldn’t be serving your app from /home, it can typically cause file permission issues. Move your site to /srv or /var/www/html instead.

1 Like

Thanks, try_files, solved the problem.

1 Like