profile
viewpoint

Ask questionscaddy run in dir with index.html -> 404 page not found

I am trying to run Caddy on a simple directory with an index.html on my Mac. Here is what happened:

[ /tmp ] mkdir foo
[ /tmp ] cd foo
[ /tmp/foo ] cat > index.html
<!DOCTYPE html>
<html>
<body>
Foo
</body>
</html>
^D
[ /tmp/foo ] caddy run
2020/05/20 20:29:32.076	INFO	admin	admin endpoint started	{"address": "tcp/localhost:2019", "enforce_origin": false, "origins": ["localhost:2019", "[::1]:2019", "127.0.0.1:2019"]}
2020/05/20 20:29:32.077	INFO	serving initial configuration

Then I opened http://localhost:2019 in Chrome. It showed a 404 message: Screen Shot 2020-05-20 at 1 36 13 PM

The log output from Caddy was this:

2020/05/20 20:29:40.438	INFO	admin.api	received request	{"method": "GET", "host": "localhost:2019", "uri": "/", "remote_addr": "127.0.0.1:53262", "headers": {"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"],"Accept-Encoding":["gzip, deflate, br"],"Accept-Language":["en-US,en;q=0.9"],"Connection":["keep-alive"],"Cookie":["_ga=GA1.1.1994289232.1582593018; hubspotutk=52eded5ff5a9b86741cbddfba3339d43; __hstc=181257784.52eded5ff5a9b86741cbddfba3339d43.1582593018760.1582909657972.1583196685957.5; _hp2_id.1345820458=%7B%22userId%22%3A%22813665436306599%22%2C%22pageviewId%22%3A%2264679101397911%22%2C%22sessionId%22%3A%22916624541847206%22%2C%22identity%22%3Anull%2C%22trackerVersion%22%3A%224.0%22%7D; io=Yq4JP3fqga6ULeyYAAAE; Goland-e18ce701=a4b3df3e-d273-41f7-99a2-453f36c21c3f; fs_uid=rs.fullstory.com#V1260#5944946839011328:5498471834599424/1620369885"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-Site":["none"],"Sec-Fetch-User":["?1"],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36"]}}
caddyserver/caddy

Answer questions ijt

Hi Francis, got it. Thanks!

useful!

Related questions

systemd caddy.service cannot work in systemd version 219 due to #2620 changes hot 1
Intelligent updating of SSL certs hot 1
quic-go v0.12.1 client can not correct to caddy v2.0.0-beta6 hot 1
failed to copy buffer xxxx use of closed network connection hot 1
v2: Caddyfile enhancements hot 1
v2: tls wrong load_files sub-directive at Caddyfile conversion and unexpected automatic HTTPS for second domain in same server block hot 1
http: TLS handshake error from x.x.x.x:y: no certificate available for '' hot 1
Invalid memory address on failing upstream servers hot 1
Github User Rank List