Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using non-existent labels placeholders will cause errors #3502

Closed
nothinggift opened this issue Jun 17, 2020 · 1 comment
Closed

Using non-existent labels placeholders will cause errors #3502

nothinggift opened this issue Jun 17, 2020 · 1 comment
Labels
bug 🐞 Something isn't working
Milestone

Comments

@nothinggift
Copy link

community link

CaddyFile:

:80 {
  encode zstd gzip
  file_server
  try_files {path} /index.html
  root * /data/web/{labels.2}/dist/{labels.3}
}

If labels.3 does not exist, it will cause an error

2020/06/16 17:16:02 http: panic serving 223.166.222.111:63424: runtime error: index out of range [-1]
goroutine 1971 [running]:
net/http.(*conn).serve.func1(0xc000a0bd60)
	net/http/server.go:1772 +0x139
panic(0x1700340, 0xc0011d6ec0)
	runtime/panic.go:975 +0x3e3
github.com/caddyserver/caddy/v2/modules/caddyhttp.addHTTPVarsToReplacer.func1(0xc000d3ab6d, 0x1a, 0x0, 0x0, 0x0)
	github.com/caddyserver/caddy/v2@v2.1.0-beta.1/modules/caddyhttp/replacer.go:180 +0x216f
github.com/caddyserver/caddy/v2.(*Replacer).Get(0xc0011a0640, 0xc000d3ab6d, 0x1a, 0x1, 0x1b, 0xc000ce1c01)
	github.com/caddyserver/caddy/v2@v2.1.0-beta.1/replacer.go:62 +0x77
github.com/caddyserver/caddy/v2.(*Replacer).replace(0xc0011a0640, 0xc000d3ab40, 0x48, 0x0, 0x0, 0x1, 0x0, 0xc0009eac80, 0x4, 0x0, ...)
	github.com/caddyserver/caddy/v2@v2.1.0-beta.1/replacer.go:164 +0x3a7
github.com/caddyserver/caddy/v2.(*Replacer).ReplaceAll(...)
	github.com/caddyserver/caddy/v2@v2.1.0-beta.1/replacer.go:101
@francislavoie francislavoie added the bug 🐞 Something isn't working label Jun 17, 2020
@mholt mholt added this to the 2.x milestone Jun 17, 2020
@mholt mholt modified the milestones: 2.x, v2.1.1 Jun 29, 2020
@mholt
Copy link
Member

mholt commented Jun 30, 2020

Thanks for the report!

@mholt mholt closed this as completed in 77f233a Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants