V2: Empty response over HTTP

Version: v2 beta 8

My Caddy file looks like this:

domain.com, www.domain.com {
root * /my/web/root/
encode gzip
file_server
}

I’ve been playing around with v2 lately and has been working pretty well for me so far. However, when I try to visit the website via HTTP directly (with ‘http://domain.nl’ as full URL), a ‘ERR_EMPTY_RESPONSE’ error is thrown. Simply approaching through ‘domain.nl’ does however work perfectly, as it redirects to HTTPS. I wonder if this is a bug or intended behaviour?

Thank you for trying v2 while it is still in beta! We definitely move fast and break things during the beta period. :slight_smile:

Is there an index file in that folder? There’s a known bug if there isn’t, which will be fixed with beta 9 today or tomorrow.

Yes there is. I’ve looked into it a bit deeper and it seems the error is thrown for every direct HTTP request, be it directly to an index file or even to a non-existing file. So for example even for something like http://domain.com/asdfasdf it throws an emtpy response error :thinking:

What is shown in the logs?

I am not sure, I’m quite the noob. Here’s the log for one failed request:

2019/11/04 18:19:13 http: panic serving my-client-ip:64639: runtime error: invalid memory address or nil pointer dereference
goroutine 36 [running]:
net/http.(*conn).serve.func1(0xc0001ccb40)
/root/golang/go/src/net/http/server.go:1767 +0x139
panic(0xcca680, 0x15290c0)
/root/golang/go/src/runtime/panic.go:679 +0x1b2
go.uber.org/zap.(*Logger).clone(...)
/root/go/pkg/mod/go.uber.org/zap@v1.10.0/logger.go:252
go.uber.org/zap.(*Logger).With(0x0, 0xc00024cf40, 0x1, 0x1, 0xc0000348c0)
/root/go/pkg/mod/go.uber.org/zap@v1.10.0/logger.go:163 +0x45
github.com/caddyserver/caddy/v2/modules/caddyhttp.(*Server).ServeHTTP(0xc000244000, 0xf1ab60, 0xc0000348c0, 0xc00013b500)
/root/source/caddy-2.0.0-beta8/modules/caddyhttp/server.go:86 +0x677
net/http.serverHandler.ServeHTTP(0xc000034380, 0xf1ab60, 0xc0000348c0, 0xc00013b200)
/root/golang/go/src/net/http/server.go:2802 +0xa4
net/http.(*conn).serve(0xc0001ccb40, 0xf1d7e0, 0xc00024ce00)
/root/golang/go/src/net/http/server.go:1890 +0x875
created by net/http.(*Server).Serve
/root/golang/go/src/net/http/server.go:2927 +0x38e

Oh, okay. Good news is this is already fixed on master, will be going out with the next beta today or tomorrow.

1 Like

@LukasDice Beta 9 is out, which should fix the errors you were seeing. Can you give it a try and tell me whether it works for you? Release 2.0 beta 9 · caddyserver/caddy · GitHub

1 Like

Yes it does now! Great work!

1 Like

The latest beta seems to have reintroduced this bug, for now I just went back to the previous beta, but I can repro this again if any logs should be needed

Please ask in a new thread, and please provide your Caddyfile and whatever logs you can so we can help you.

1 Like

As Francis said, please post a new thread with more details, or if it’s a bug, file an issue on GitHub and we’ll take a look (or ask for more information if needed). Thanks!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.