Commit 4d907d57 authored by Matthew Holt's avatar Matthew Holt

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)!
parent 24352e79
...@@ -364,20 +364,22 @@ func autoConfigure(allConfigs []server.Config, cfgIndex int) []server.Config { ...@@ -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. for i, c := range allConfigs {
if c.Address() == cfg.Host+":80" ||
c.Address() == cfg.Host+":443" ||
c.Address() == cfg.Host+":http" ||
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) handler := new(Handler)
mid := func(next middleware.Handler) middleware.Handler { mid := func(next middleware.Handler) middleware.Handler {
handler.Next = next handler.Next = next
return handler return handler
} }
acmeHandlers[cfg.Host] = 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
// Handler needs to go in 80 and 443
for i, c := range allConfigs {
if c.Address() == cfg.Host+":80" ||
c.Address() == cfg.Host+":443" ||
c.Address() == cfg.Host+":http" ||
c.Address() == cfg.Host+":https" {
allConfigs[i].Middleware["/"] = append(allConfigs[i].Middleware["/"], mid) allConfigs[i].Middleware["/"] = append(allConfigs[i].Middleware["/"], mid)
} }
} }
......
CADDY 0.8 beta 3 CADDY 0.8 beta 4
Website Website
https://caddyserver.com https://caddyserver.com
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment