abiosoft/caddy-docker

panic: runtime error: slice bounds out of range

emarref opened this issue · 7 comments

We are running caddy in a Kubernetes environment. The latest docker hub caddy update (1.0.2) has caused a panic, and our deployment never finishes. Caddy version 1.0.1 does not have this issue. This issue affects abiosoft/caddy from Docker Hub.

The error message we get is:

panic: runtime error: slice bounds out of range

goroutine 1 [running]:
github.com/caddyserver/caddy/caddyhttp/httpserver.Address.Key(...)
	/go/pkg/mod/github.com/caddyserver/caddy@v1.0.2/caddyhttp/httpserver/plugin.go:494
github.com/caddyserver/caddy/caddyhttp/httpserver.(*httpContext).InspectServerBlocks(0xc000144180, 0x7fff8bfd2550, 0xe, 0xc000135580, 0x1, 0x1, 0xc000135580, 0x1, 0x1, 0x0, ...)
	/go/pkg/mod/github.com/caddyserver/caddy@v1.0.2/caddyhttp/httpserver/plugin.go:143 +0x12ee
github.com/caddyserver/caddy.ValidateAndExecuteDirectives(0xe04020, 0xc000141040, 0xc00011a300, 0xc00011a300, 0x1, 0xc00000e600)
	/go/pkg/mod/github.com/caddyserver/caddy@v1.0.2/caddy.go:614 +0x3b7
github.com/caddyserver/caddy.startWithListenerFds(0xe04020, 0xc000141040, 0xc00011a300, 0x0, 0x0, 0x0)
	/go/pkg/mod/github.com/caddyserver/caddy@v1.0.2/caddy.go:516 +0x125
github.com/caddyserver/caddy.Start(0xe04020, 0xc000141040, 0xe04020, 0xc000141040, 0x0)
	/go/pkg/mod/github.com/caddyserver/caddy@v1.0.2/caddy.go:473 +0xea
github.com/caddyserver/caddy/caddy/caddymain.Run()
	/go/pkg/mod/github.com/caddyserver/caddy@v1.0.2/caddy/caddymain/run.go:193 +0x646
main.main()
	/caddy/main.go:13 +0x5d
exit status 2

With the following Caddyfile:

:80
tls off
root /var/empty
fastcgi / localhost:9000 php {
    root /var/www/public
}

Can confirm, we have the same issue. Caddyfile:

our.domain:80 {
}

our.domain:443 {
  tls self_signed

  proxy /api http://server:5000 {
    transparent
  }
}

internal.net:443 {
  tls server.crt server.key

  proxy /api http://server:5000 {
    transparent
  }
}

Looking into it. Kindly stick to 1.0.1 for now.

Looks related to this caddyserver/caddy#2706

toabi commented

This change in the config files fixes the issue with 1.0.2 caddyserver/caddy#2706 (comment)

A release with a fix is imminent caddyserver/caddy#2706 (comment).

Awesome thanks very much

Fixed upstream. Docker hub should have 1.0.3 in few hours when the builds are done.