Closed jungle-boogie closed 4 years ago
Thank you for trying v2! And for filling out most of the issue template. :smile: Can you answer # 5 please? :) I am having trouble reproducing this with the given information.
And is the file that you're requesting on disk, have the right permissions, etc? How can I reproduce this?
Hi Matt,
Once caddy was started, I made an http request to localhost:2019 via Firefox. I then saw the panic in the powershell window. Caddy was started by my user, who has access to the files on disk.
@jungle-boogie Thanks, but I mean more specifically: does the file you're requesting exist? Can you send me the exact HTTP request (at least the path) and the list of files in the folder that you're running it from?
hi Matt,
I didn’t specify a file when I went to the webbrowser, just the root dir. I had many files in the same directory as caddy itself, as caddy was still in my downloads directory.
Maybe I’m doing something wrong. Do I need a caddy file, either JSON or v1 style? Do I need to post a caddy file prior to browsing to the URL? How exactly should file-server function and what should be the outcome?
Okay, so request path is /
.
Please, do you have the file listing? I need to know what is in the directory if I am going to be able to reproduce the error.
Or at least tell me if there is an index file?
I may have made a mistake above. The docs show default port of 2015 and I'm pretty sure that's what I used in firefox, not 2019.
Sorry, I don't have a list of the files at this time. I'll re-test on Windows 10 tomorrow. There was no index file in the downloads directory.
Okay. Thanks, based on that I was able to track down what is likely the reason for the panic, and pushed a fix to the v2 branch. Try it out and let me know if it also works for you!
Okay, I have an update...
This also panics on Ubuntu when a request is made to /. When I specified a file, there was no panic.
$ touch matt
$ ./caddy2_beta8_linux_amd64 file-server
2019/10/30 21:12:25 [INFO][cache:0xc0001208c0] Started certificate maintenance routine
1.5724951456026516e+09 INFO tls cleaned up storage units
2019/10/30 21:12:25 Caddy 2 serving static files on :2015
browse to http://localhost:2015/matt
no panic
now delete /matt and browse, panic happens.
Verified fixed in 8d3c64932eddb42f7e5c4549555e9d12a559d552
Sorry for so much back and forth, and good job on fixing this.
Excellent, thank you for confirming!! I appreciate your time in getting that resolved.
This issue is still present.
From a directory with nothing in it except caddy, I ran:
sudo ./caddy file-server >& log
Connecting to it with curl http://localhost
gives me this error.
{"level":"warn","ts":1586590736.400914,"logger":"admin","msg":"admin endpoint disabled"}
{"level":"info","ts":1586590736.4010906,"logger":"http","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"static","http_port":80}
{"level":"info","ts":1586590736.4016533,"logger":"tls","msg":"cleaned up storage units"}
2020/04/11 00:38:56 [INFO][cache:0xc0004da320] Started certificate maintenance routine
{"level":"info","ts":1586590736.4019477,"msg":"autosaved config","file":"/root/.config/caddy/autosave.json"}
2020/04/11 00:38:56 Caddy 2 serving static files on :80
2020/04/11 00:38:59 http: panic serving 127.0.0.1:49572: runtime error: invalid memory address or nil pointer dereference
goroutine 13 [running]:
net/http.(*conn).serve.func1(0xc0002c4d20)
net/http/server.go:1772 +0x139
panic(0x144d380, 0x2470800)
runtime/panic.go:975 +0x3e3
github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Server).ServeHTTP(0xc0000ac360, 0x192e2e0, 0xc0007e8380, 0xc000417600)
github.com/caddyserver/caddy/v2@v2.0.0-rc.2/modules/caddyhttp/server.go:203 +0x932
net/http.serverHandler.ServeHTTP(0xc0007e81c0, 0x192e2e0, 0xc0007e8380, 0xc000417300)
net/http/server.go:2807 +0xa3
net/http.(*conn).serve(0xc0002c4d20, 0x19334e0, 0xc00012c840)
net/http/server.go:1895 +0x86c
created by net/http.(*Server).Serve
net/http/server.go:2933 +0x35c
{"level":"info","ts":1586590741.0869493,"msg":"shutting down","signal":"SIGINT"}
2020/04/11 00:39:01 [INFO][cache:0xc0004da320] Stopped certificate maintenance routine
{"level":"info","ts":1586590741.0872684,"msg":"shutdown done","signal":"SIGINT"}
Running on Ubuntu 19.10 x64, Caddy version: v2.0.0-rc.2 h1:7NOaxYrsnQ5D3rcLGn2UnLZHLfBpgrfM/JNTLhjCJ1c=
@tspivey Not the same issue. What you're seeing is the same as https://github.com/caddyserver/caddy/issues/3248 which has been fixed in the master branch. You can grab the latest build artifact from https://github.com/caddyserver/caddy/actions/runs/75592323 which has the fix.
1. Which version of Caddy are you using (
caddy -version
)?caddy2_beta8_windows_amd64.exe
2. What are you trying to do?
> .\caddy2_beta8_windows_amd64.exe file-server
3. What is your Caddyfile?
blank/non-existent
4. How did you run Caddy (give the full command and describe the execution environment)?
> .\caddy2_beta8_windows_amd64.exe file-server
Windows 10 go version go1.12.7 windows/amd64
5. Please paste any relevant HTTP request(s) here.
http://localhost:2019
6. What did you expect to see?
File browser on the webpage
7. What did you see instead (give full error messages and/or log)?
8. Why is this a bug, and how do you think this should be fixed?
Panic in the application isn't good. file-server is listed as a feature in caddy v2: https://github.com/caddyserver/caddy/wiki/v2:-Documentation#file-server
9. What are you doing to work around the problem in the meantime?
Still playing with v2
10. Please link to any related issues, pull requests, and/or discussion.
None found.
Bonus: What do you use Caddy for? Why did you choose Caddy?
Easy!