1. The problem I’m having:
I cannot get caddy to match this:
route /api/v1/uploadvideo/{project_name}/{user_name}
2. Error messages and/or full log output:
sudo /usr/bin/caddy run --config /etc/caddy/Caddyfile
2024/05/22 20:29:19.336 INFO using provided configuration {"config_file": "/etc/caddy/Caddyfile", "config_adapter": ""}
2024/05/22 20:29:19.338 INFO admin admin endpoint started {"address": "localhost:2019", "enforce_origin": false, "origins": ["//127.0.0.1:2019", "//localhost:2019", "//[::1]:2019"]}
2024/05/22 20:29:19.338 WARN http.auto_https automatic HTTPS is completely disabled for server {"server_name": "srv0"}
2024/05/22 20:29:19.338 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0xc00042dc80"}
2024/05/22 20:29:19.338 DEBUG http.auto_https adjusted config {"tls": {"automation":{"policies":[{}]}}, "http": {"servers":{"srv0":{"listen":[":80"],"routes":[{"handle":[{"handler":"subroute","routes":[{"handle":[{"handler":"subroute","routes":[{"handle":[{"body":"response 1","handler":"static_response","status_code":200}]}]}],"match":[{"path":["/api/v1/uploadvideo/{project_name}/{user_name}"]}]},{"handle":[{"handler":"subroute","routes":[{"handle":[{"body":"response 2","handler":"static_response","status_code":200}]}]}],"match":[{"path":["/api/v1/uploadvideo/*"]}]},{"handle":[{"handler":"subroute","routes":[{"handle":[{"body":"response 3","handler":"static_response","status_code":200}]}]}],"match":[{"path":["/api/*"]}]}]}],"terminal":true}],"automatic_https":{"disable":true}}}}}
2024/05/22 20:29:19.339 DEBUG http starting server loop {"address": "[::]:80", "tls": false, "http3": false}
2024/05/22 20:29:19.339 INFO http.log server running {"name": "srv0", "protocols": ["h1", "h2", "h3"]}
2024/05/22 20:29:19.339 INFO autosaved config (load with --resume flag) {"file": "/root/.config/caddy/autosave.json"}
2024/05/22 20:29:19.339 INFO serving initial configuration
2024/05/22 20:29:19.450 WARN tls storage cleaning happened too recently; skipping for now {"storage": "FileStorage:/root/.local/share/caddy", "instance": "b4e0cb70-e002-4d4c-997a-97846c91d775", "try_again": "2024/05/23 20:29:19.450", "try_again_in": 86399.999998802}
2024/05/22 20:29:19.450 INFO tls finished cleaning storage units
^C2024/05/22 20:32:18.978 INFO shutting down {"signal": "SIGINT"}
2024/05/22 20:32:18.978 WARN exiting; byeee!! 👋 {"signal": "SIGINT"}
2024/05/22 20:32:18.979 INFO http servers shutting down with eternal grace period
2024/05/22 20:32:18.979 INFO admin stopped previous server {"address": "localhost:2019"}
2024/05/22 20:32:18.979 INFO shutdown complete {"signal": "SIGINT", "exit_code": 0}
3. Caddy version:
caddy --version
v2.7.6 h1:w0NymbG2m9PcvKWsrXO6EEkY9Ru4FJK8uQbYcev1p3A=
4. How I installed and ran Caddy:
Sorry cannot recall.
a. System environment:
Ubuntu 22.04.4 LTS
Intel
b. Command:
sudo /usr/bin/caddy run --config /etc/caddy/Caddyfile
c. Service/unit/compose file:
d. My complete Caddy config:
{
debug
auto_https off
}
www.powergrabber.com:80 {
route /api/v1/uploadvideo/{project_name}/{user_name} {
respond "response 1" 200
}
route /api/v1/uploadvideo/* {
respond "response 2" 200
}
route /api/* {
respond "response 3" 200
}
}
5. Links to relevant resources:
None of the curl commands I enter result in this route responding:
route /api/v1/uploadvideo/{project_name}/{user_name}
curl -H "Host: www.powergrabber.com" http://192.168.0.130/api/v1/uploadvideo
response 3%
curl -H "Host: www.powergrabber.com" http://192.168.0.130/api/v1/foo
response 3%
curl -H "Host: www.powergrabber.com" http://192.168.0.130/api/v1/uploadvideo/rabbits
response 2%
curl -H "Host: www.powergrabber.com" http://192.168.0.130/api/v1/uploadvideo/rabbits/dogs
response 2%
curl -H "Host: www.powergrabber.com" http://192.168.0.130/api/v1/uploadvideo/rabbits/dogs/
response 2%
curl -H "Host: www.powergrabber.com" http://192.168.0.130/api/v1/uploadvideo/
response 2%
curl -H "Host: www.powergrabber.com" http://192.168.0.130/api/v1/uploadvideo/rabbits/dogs/monkeys
response 2%