mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-22 09:39:58 +08:00
proxy: make http header block scoped
Each proxy block should could specify its own http header instead of sharing a global one. Fix issue #341 Signed-off-by: Tw <tw19881113@gmail.com>
This commit is contained in:
@ -98,11 +98,6 @@ func TestWebSocketReverseProxyFromWSClient(t *testing.T) {
|
||||
// also sets up the rules/environment for testing WebSocket
|
||||
// proxy.
|
||||
func newWebSocketTestProxy(backendAddr string) *Proxy {
|
||||
proxyHeaders = http.Header{
|
||||
"Connection": {"{>Connection}"},
|
||||
"Upgrade": {"{>Upgrade}"},
|
||||
}
|
||||
|
||||
return &Proxy{
|
||||
Upstreams: []Upstream{&fakeUpstream{name: backendAddr}},
|
||||
}
|
||||
@ -121,7 +116,9 @@ func (u *fakeUpstream) Select() *UpstreamHost {
|
||||
return &UpstreamHost{
|
||||
Name: u.name,
|
||||
ReverseProxy: NewSingleHostReverseProxy(uri, ""),
|
||||
ExtraHeaders: proxyHeaders,
|
||||
ExtraHeaders: http.Header{
|
||||
"Connection": {"{>Connection}"},
|
||||
"Upgrade": {"{>Upgrade}"}},
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user