mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-27 14:13:48 +03:00
reverseproxy: Fix panic when using header-related flags (fix #6464)
This commit is contained in:
parent
b2492f8567
commit
806f5b1117
1 changed files with 7 additions and 5 deletions
|
@ -229,11 +229,13 @@ func cmdReverseProxy(fs caddycmd.Flags) (int, error) {
|
||||||
|
|
||||||
if changeHost {
|
if changeHost {
|
||||||
if handler.Headers == nil {
|
if handler.Headers == nil {
|
||||||
handler.Headers = &headers.Handler{
|
handler.Headers = new(headers.Handler)
|
||||||
Request: &headers.HeaderOps{
|
|
||||||
Set: http.Header{},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
if handler.Headers.Request == nil {
|
||||||
|
handler.Headers.Request = new(headers.HeaderOps)
|
||||||
|
}
|
||||||
|
if handler.Headers.Request.Set == nil {
|
||||||
|
handler.Headers.Request.Set = http.Header{}
|
||||||
}
|
}
|
||||||
handler.Headers.Request.Set.Set("Host", "{http.reverse_proxy.upstream.hostport}")
|
handler.Headers.Request.Set.Set("Host", "{http.reverse_proxy.upstream.hostport}")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue