1. Caddy version (caddy version
):
2.4
2. How I run Caddy:
caddy run
a. System environment:
Ubuntu VM
b. Command:
sudo caddy run
d. My complete Caddyfile or JSON config:
dub.domain.net
{
route * {
root * path/to/build/dir
try_files {path} try_files /index.html reverse_proxy 127.0.0.1:1338
file_server
}
}
3. The problem I’m having:
I’m in the process of switching my deploymentprocess over to hosting all static files via caddy and also let it taking care of the reverse-proxy process.
The main issue I got now Is that I’m looking for the following behaviour:
- Check if path is /, in this case serve the index.html
- If there is a path, serve the file on that path, if it exists.
- If there is no file, reverse proxy everything the a server running on port 1338
I have a hard time getting to that logic, maybe someone can give me a hint in the right direction.
4. Error messages and/or full log output:
No errors, only wrong files delivered.
5. What I already tried:
I’m trying different setups. I’m mainly thinking about creating one route for /, and then doing the rest with the try_files directive.