mirror of
https://github.com/caddyserver/caddy.git
synced 2025-02-25 09:18:56 +01:00
Whoops, emergency bug fix
Made a faulty assumption that virualhosts could share acme proxy handlers; turns out they can't without fumbling up the middleware configuration (middleware chains overlap and cross over into other virtualhosts)!
This commit is contained in:
parent
24352e799a
commit
4d907d57fa
2 changed files with 12 additions and 10 deletions
|
@ -364,20 +364,22 @@ func autoConfigure(allConfigs []server.Config, cfgIndex int) []server.Config {
|
||||||
|
|
||||||
// To support renewals, we need handlers at ports 80 and 443,
|
// To support renewals, we need handlers at ports 80 and 443,
|
||||||
// depending on the challenge type that is used to complete renewal.
|
// depending on the challenge type that is used to complete renewal.
|
||||||
// Every proxy for this host can share the handler.
|
|
||||||
handler := new(Handler)
|
|
||||||
mid := func(next middleware.Handler) middleware.Handler {
|
|
||||||
handler.Next = next
|
|
||||||
return handler
|
|
||||||
}
|
|
||||||
acmeHandlers[cfg.Host] = handler
|
|
||||||
|
|
||||||
// Handler needs to go in 80 and 443
|
|
||||||
for i, c := range allConfigs {
|
for i, c := range allConfigs {
|
||||||
if c.Address() == cfg.Host+":80" ||
|
if c.Address() == cfg.Host+":80" ||
|
||||||
c.Address() == cfg.Host+":443" ||
|
c.Address() == cfg.Host+":443" ||
|
||||||
c.Address() == cfg.Host+":http" ||
|
c.Address() == cfg.Host+":http" ||
|
||||||
c.Address() == cfg.Host+":https" {
|
c.Address() == cfg.Host+":https" {
|
||||||
|
|
||||||
|
// Each virtualhost must have their own handlers, or the chaining gets messed up when middlewares are compiled!
|
||||||
|
handler := new(Handler)
|
||||||
|
mid := func(next middleware.Handler) middleware.Handler {
|
||||||
|
handler.Next = next
|
||||||
|
return handler
|
||||||
|
}
|
||||||
|
// TODO: Currently, acmeHandlers are not referenced, but we need to add a way to toggle
|
||||||
|
// their proxy functionality -- or maybe not. Gotta figure this out for sure.
|
||||||
|
acmeHandlers[c.Address()] = handler
|
||||||
|
|
||||||
allConfigs[i].Middleware["/"] = append(allConfigs[i].Middleware["/"], mid)
|
allConfigs[i].Middleware["/"] = append(allConfigs[i].Middleware["/"], mid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
dist/README.txt
vendored
2
dist/README.txt
vendored
|
@ -1,4 +1,4 @@
|
||||||
CADDY 0.8 beta 3
|
CADDY 0.8 beta 4
|
||||||
|
|
||||||
Website
|
Website
|
||||||
https://caddyserver.com
|
https://caddyserver.com
|
||||||
|
|
Loading…
Reference in a new issue