1. The problem I’m having:
I am trying file upload a file (test3.txt) to caddy file server (caddy:2.6.4-alpine). The command i am using is as below,
curl -T test3.txt -X PUT “http://localhost:8089/” -vvv
I have given all permissions required,
caddy$ ll test3.txt site*
-rw-rw-r-- 1 abjyoti abjyoti 0 May 11 09:54 test3.txt
site:
total 24
drwxrwxrwx 3 abjyoti abjyoti 4096 May 10 13:09 ./
drwxrwxr-x 8 abjyoti abjyoti 4096 May 11 09:54 …/
-rwxrwxrwx 1 abjyoti abjyoti 565 May 10 08:01 caddy.json*
drwxrwxrwx 2 abjyoti abjyoti 4096 May 10 13:09 dir_a/
-rwxrwxrwx 1 abjyoti abjyoti 31 May 10 07:15 test2.txt*
-rwxrwxrwx 1 abjyoti abjyoti 31 May 10 07:12 test.txt*
2. Error messages and/or full log output:
Error log on console:
caddy$ curl --noproxy “*” -T test3.txt -X PUT “http://localhost:8089/” -vL
- Trying 127.0.0.1:8089…
- Connected to localhost (127.0.0.1) port 8089 (#0)
PUT /test3.txt HTTP/1.1
Host: localhost:8089
User-Agent: curl/7.81.0
Accept: /
Content-Length: 0
- Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Server: Caddy
< Date: Thu, 11 May 2023 10:09:49 GMT
< Content-Length: 0
< - Connection #0 to host localhost left intact
I am getting the debug log as below in the caddy server,
2023/05/11 10:09:49.240 DEBUG http.handlers.file_server sanitized path join {“site_root”: “/site”, “request_path”: “/test3.txt”, “result”: “/site/test3.txt”}
2023/05/11 10:09:49.240 DEBUG http.log.error {id=ucbfrf2cs} fileserver.(FileServer).notFound (staticfiles.go:601): HTTP 404 {“request”: {“remote_ip”: “172.17.0.1”, “remote_port”: “59014”, “proto”: “HTTP/1.1”, “method”: “PUT”, “host”: “localhost:8089”, “uri”: “/test3.txt”, “headers”: {“User-Agent”: [“curl/7.81.0”], “Accept”: ["/*"], “Content-Length”: [“0”]}}, “duration”: 0.000180767, “status”: 404, “err_id”: “ucbfrf2cs”, “err_trace”: “fileserver.(*FileServer).notFound (staticfiles.go:601)”}
2023/05/11 10:09:49.240 DEBUG http.handlers.file_server sanitized path join {"site_root": "/site", "request_path": "/test3.txt", "result": "/site/test3.txt"}
2023/05/11 10:09:49.240 DEBUG http.log.error {id=ucbfrf2cs} fileserver.(*FileServer).notFound (staticfiles.go:601): HTTP 404 {"request": {"remote_ip": "172.17.0.1", "remote_port": "59014", "proto": "HTTP/1.1", "method": "PUT", "host": "localhost:8089", "uri": "/test3.txt", "headers": {"User-Agent": ["curl/7.81.0"], "Accept": ["*/*"], "Content-Length": ["0"]}}, "duration": 0.000180767, "status": 404, "err_id": "ucbfrf2cs", "err_trace": "fileserver.(*FileServer).notFound (staticfiles.go:601)"}
3. Caddy version:
Version of caddy docker image: caddy:2.6.4-alpine sh
4. How I installed and ran Caddy:
Following are the steps used to deploy the caddy server;
sudo ufw allow 8089
sudo ufw allow 2019
docker run -d -it -p 8089:8089 -p 2019:2019 -p 2020:2020
-v ./site:/site
-v ./caddy_data:/data
-v ./caddy_config:/config
-v ./Caddyfile:/etc/caddy/Caddyfile
-v ./static:/static
–name caddyserver
caddy:2.6.4-alpine sh
docker exec -it caddyserver caddy adapt --config /etc/caddy/Caddyfile
docker exec -d -it caddyserver caddy run --config /etc/caddy/Caddyfile
docker logs caddyserver -f
a. System environment:
Host OS: Ubuntu 22.04 LTS Server
Version of caddy docker image: caddy:2.6.4-alpine sh
b. Command:
curl --noproxy "*" -T test3.txt -X PUT "http://localhost:8089/" -vL
c. Service/unit/compose file:
d. My complete Caddy config:
{
admin :2019
auto_https off
debug
}
:8089 {
root * /site
file_server browse
}