Caddy 0.9.5
Serve files via browse from a directory.
example.de/files {
root /home/caddy/files
browse
}
Via a systemd service as user caddy.
ref: caddyserver/examples/systemd
If i klick on a link, i get https://example.com/testfile.txt instead of https://example.com/files/testfile.txt
hi @janstuemmel thanks for the issue.
I have reproduced this. A workaround in the time being seems to be
example.de {
root /home/caddy/
browse /files
}
which seems to work as expected.
Edit : This does seem intermittant, bug happens on breadcrumb link, but that is a bad a link.
Does it happen on master too? Or just 0.9.5?
@tobya @janstuemmel , I can reproduce with this config
localhost:2015 {
log / stdout "{combined}"
}
localhost:2015/tmp {
root /tmp
browse
}
However, If I add a trailing slash to tmp, to become localhost:2015/tmp/ all of the HREF links render correctly. So I think this is more of a trailing slash issue?
Caddy 0.9.5 / Chrome 57
@mholt see my comment above, 0.9.5 OSX binary
@jamesboswell I know, I was talking to @tobya. Sorry.
hi guys, thanks for the quick response. i came up to this cause' of playing around a bit with caddy before going to the pub. love your software btw, and never go back to apache :smile:
@mholt, i pulled caddy with go get github.com/mholt/caddy/caddy (should be master, am i wrong?) and doesnt works as described above...
@jamesboswell, yes right, it works with a trailing slash! But not the breadcrumb link...
@tobya, i think you understand me wrong (but maybe my english is too bad),
i wanted an apache-like alias e.g. Alias /files /var/www/files to browse files.
Reproduce
Caddyfile in /home/user/tmp/foo with a file /home/user/tmp/foo/testfile.txt:
localhost/files
browse
in shell
(cd /home/user/tmp/foo && ~/go/bin/caddy)
after that, the files are displayed at localhost:2015/files, but if i klick on a file, i get the address localhost:2015/testfile.txt instead of localhost:2015/files/testfile.txt, which is obviously a 404.
If i visit localhost:2015/files/, the scenario works!
I see this too, I'll see what I can do. Thanks for the clear instructions.
@janstuemmel
If i visit localhost:2015/files/, the scenario works!
This is expected; it's a quirk that mixes URL and path conventions and how browsers render links. The browser sees a path like "/files" as a file even though in this case it's neither a file or a directory. Normally, directories have a trailing slash like "/files/" so if you want your site root to behave like a directory, append a trailing slash: localhost/files/
I'm fixing the breadcrumb links though. For a site defined as localhost/files/ and a path of "localhost/files/subfolder/" do you prefer a breadcrumb of:
A) /subfolder/
or
B) /files/subfolder (with the ability to navigate to / instead of just /files/)
Nevermind, I'm gonna go with (A). Seems most correct I think. Pushing fix soon!