fix header checking
This commit is contained in:
parent
e93f353860
commit
efefc76929
|
@ -51,11 +51,11 @@ func (p *ForwardProxyCluster) validateRequestAndGetProxy(w http.ResponseWriter,
|
|||
return "", "", "", "", nil, errors.New(errStr)
|
||||
}
|
||||
|
||||
headerIncludeBrokenThirdparty := req.Header.Get(HeaderThirdpartyIncludeBroken)
|
||||
headerIncludeBrokenThirdparty := req.Header.Get(HeaderThirdpartyIncludeBroken) != ""
|
||||
req.Header.Del(HeaderThirdpartyIncludeBroken)
|
||||
headerBypassThirdparty := req.Header.Get(HeaderThirdpartyBypass)
|
||||
headerBypassThirdparty := req.Header.Get(HeaderThirdpartyBypass) != ""
|
||||
req.Header.Del(HeaderThirdpartyBypass)
|
||||
if headerBypassThirdparty != "" && headerIncludeBrokenThirdparty != "" {
|
||||
if headerBypassThirdparty && headerIncludeBrokenThirdparty {
|
||||
errStr := "duplicate options headers detected, rejecting request"
|
||||
http.Error(w, errStr, http.StatusBadRequest)
|
||||
return "", "", "", "", nil, errors.New(errStr)
|
||||
|
@ -69,9 +69,9 @@ func (p *ForwardProxyCluster) validateRequestAndGetProxy(w http.ResponseWriter,
|
|||
if slices.Contains(config.GetConfig().ThirdpartyBypassDomains, urlHostname) {
|
||||
selectedProxy = p.getProxyFromOurs()
|
||||
} else {
|
||||
if headerIncludeBrokenThirdparty != "" {
|
||||
if headerIncludeBrokenThirdparty {
|
||||
selectedProxy = p.getProxyFromAllWithBroken()
|
||||
} else if headerBypassThirdparty != "" {
|
||||
} else if headerBypassThirdparty {
|
||||
selectedProxy = p.getProxyFromOurs()
|
||||
} else {
|
||||
selectedProxy = p.getProxyFromAll()
|
||||
|
|
Loading…
Reference in New Issue