plugin/forward: crash if using https (#3817)

Signed-off-by: kadern0 <kaderno@gmail.com>
This commit is contained in:
kadern0
2020-04-10 04:26:28 +10:00
committed by GitHub
parent 08120096eb
commit e410760a49
2 changed files with 6 additions and 0 deletions

View File

@@ -99,8 +99,13 @@ func parseStanza(c *caddy.Controller) (*Forward, error) {
}
transports := make([]string, len(toHosts))
allowedTrans := map[string]bool{"dns": true, "tls": true}
for i, host := range toHosts {
trans, h := parse.Transport(host)
if !allowedTrans[trans] {
return f, fmt.Errorf("'%s' is not supported as a destination protocol in forward: %s", trans, host)
}
p := NewProxy(h, trans)
f.proxies = append(f.proxies, p)
transports[i] = trans