Skip to content

Commit f16c9e7

Browse files
authored
Fix domain check and add debugging (#1405)
1 parent 245b5e2 commit f16c9e7

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

handlers/geolocation/geolocation.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ func (c *GeolocationHandlersCollection) RedirectHandler() httprouter.Handle {
209209
"redirectType": redirectType,
210210
"playbackID": playbackID,
211211
"from": r.URL.String(),
212+
"to": rURL.String(),
212213
"dnsChosenRegion": c.Config.OwnRegion,
213214
"mistChosenRegion": bestNode,
214215
"lat": lat,
@@ -224,6 +225,26 @@ func (c *GeolocationHandlersCollection) alternativeNodeDomain(req *http.Request,
224225
if len(c.Config.LBReplaceDomains) < 1 || req == nil || req.URL == nil || redirectUrl == nil {
225226
return
226227
}
228+
debugIds := []string{
229+
"c361lgm5kq0w849z",
230+
"69e0el6b58iqh39y",
231+
"453cqchdr4foj84j",
232+
"8462059yn5ek7rw6",
233+
"fbbdud4v4admc4js",
234+
"0c0d8hvh6iad0pqe",
235+
"4b70o3qyrmz63hpk",
236+
"75353kud5g4q9dsg",
237+
"a23fcrxpw4qavfkh",
238+
"6d4cyfcgae37vfcn",
239+
"1fa6edgcmzqjtyyk",
240+
"7fbbbzlcnnqhswee",
241+
}
242+
for _, debugId := range debugIds {
243+
if strings.Contains(redirectUrl.String(), debugId) {
244+
glog.Infof("alternativeNodeDomain. queryparams=%v referer=%s", req.URL.Query(), req.Header.Get("Referer"))
245+
break
246+
}
247+
}
227248

228249
switchDomain := false
229250
for _, referer := range c.Config.LBReplaceDomainReferers {
@@ -235,7 +256,7 @@ func (c *GeolocationHandlersCollection) alternativeNodeDomain(req *http.Request,
235256

236257
if !switchDomain {
237258
for k, v := range c.Config.LBReplaceDomainQueryParams {
238-
switchDomain = req.URL.Query().Get(k) == v
259+
switchDomain = req.URL.Query().Get(k) == v || strings.Contains(req.URL.RawQuery, fmt.Sprintf("%s=%s", k, v))
239260
if switchDomain {
240261
break
241262
}

0 commit comments

Comments
 (0)