mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-31 00:06:04 +08:00
Minor improvements; comments and shorter placeholders & module IDs
This commit is contained in:
@ -106,7 +106,7 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
|
||||
return d.Err("load balancing selection policy already specified")
|
||||
}
|
||||
name := d.Val()
|
||||
mod, err := caddy.GetModule("http.handlers.reverse_proxy.selection_policies." + name)
|
||||
mod, err := caddy.GetModule("http.reverse_proxy.selection_policies." + name)
|
||||
if err != nil {
|
||||
return d.Errf("getting load balancing policy module '%s': %v", mod, err)
|
||||
}
|
||||
@ -389,7 +389,7 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
|
||||
return d.Err("transport already specified")
|
||||
}
|
||||
name := d.Val()
|
||||
mod, err := caddy.GetModule("http.handlers.reverse_proxy.transport." + name)
|
||||
mod, err := caddy.GetModule("http.reverse_proxy.transport." + name)
|
||||
if err != nil {
|
||||
return d.Errf("getting transport module '%s': %v", mod, err)
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ func cmdReverseProxy(fs caddycmd.Flags) (int, error) {
|
||||
Headers: &headers.Handler{
|
||||
Request: &headers.HeaderOps{
|
||||
Set: http.Header{
|
||||
"Host": []string{"{http.handlers.reverse_proxy.upstream.host}"},
|
||||
"Host": []string{"{http.reverse_proxy.upstream.host}"},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -288,13 +288,13 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyht
|
||||
r = r.WithContext(ctx)
|
||||
|
||||
// set placeholders with information about this upstream
|
||||
repl.Set("http.handlers.reverse_proxy.upstream.address", dialInfo.String())
|
||||
repl.Set("http.handlers.reverse_proxy.upstream.hostport", dialInfo.Address)
|
||||
repl.Set("http.handlers.reverse_proxy.upstream.host", dialInfo.Host)
|
||||
repl.Set("http.handlers.reverse_proxy.upstream.port", dialInfo.Port)
|
||||
repl.Set("http.handlers.reverse_proxy.upstream.requests", strconv.Itoa(upstream.Host.NumRequests()))
|
||||
repl.Set("http.handlers.reverse_proxy.upstream.max_requests", strconv.Itoa(upstream.MaxRequests))
|
||||
repl.Set("http.handlers.reverse_proxy.upstream.fails", strconv.Itoa(upstream.Host.Fails()))
|
||||
repl.Set("http.reverse_proxy.upstream.address", dialInfo.String())
|
||||
repl.Set("http.reverse_proxy.upstream.hostport", dialInfo.Address)
|
||||
repl.Set("http.reverse_proxy.upstream.host", dialInfo.Host)
|
||||
repl.Set("http.reverse_proxy.upstream.port", dialInfo.Port)
|
||||
repl.Set("http.reverse_proxy.upstream.requests", strconv.Itoa(upstream.Host.NumRequests()))
|
||||
repl.Set("http.reverse_proxy.upstream.max_requests", strconv.Itoa(upstream.MaxRequests))
|
||||
repl.Set("http.reverse_proxy.upstream.fails", strconv.Itoa(upstream.Host.Fails()))
|
||||
|
||||
// mutate request headers according to this upstream;
|
||||
// because we're in a retry loop, we have to copy
|
||||
|
Reference in New Issue
Block a user