|
@@ -302,20 +302,16 @@ func (p *ReverseProxy) ProxyHTTP(rw http.ResponseWriter, req *http.Request, rrr
|
|
|
locationRewrite := res.Header.Get("Location")
|
|
|
originLocation := res.Header.Get("Location")
|
|
|
res.Header.Set("zr-origin-location", originLocation)
|
|
|
- /*
|
|
|
- domainWithoutPort := rrr.ProxyDomain
|
|
|
- if strings.Contains(rrr.ProxyDomain, ":") {
|
|
|
- //Split the port away
|
|
|
- domainWithoutPort = strings.Split(rrr.ProxyDomain, ":")[0]
|
|
|
- }
|
|
|
|
|
|
- //Trim away the source headers if exists
|
|
|
+ domainWithoutPort := rrr.ProxyDomain
|
|
|
+ if strings.Contains(rrr.ProxyDomain, ":") {
|
|
|
+ //Split the port away
|
|
|
+ domainWithoutPort = strings.Split(rrr.ProxyDomain, ":")[0]
|
|
|
+ }
|
|
|
|
|
|
- locationRewrite = strings.TrimPrefix(locationRewrite, "http://"+rrr.ProxyDomain)
|
|
|
- locationRewrite = strings.TrimPrefix(locationRewrite, "http://"+domainWithoutPort)
|
|
|
- locationRewrite = strings.TrimPrefix(locationRewrite, "https://"+rrr.ProxyDomain)
|
|
|
- locationRewrite = strings.TrimPrefix(locationRewrite, "https://"+domainWithoutPort)
|
|
|
- */
|
|
|
+ //Trim away the source headers if exists
|
|
|
+ locationRewrite = strings.TrimPrefix(locationRewrite, "http://"+rrr.ProxyDomain)
|
|
|
+ locationRewrite = strings.TrimPrefix(locationRewrite, "http://"+domainWithoutPort)
|
|
|
|
|
|
//Custom redirection to this rproxy relative path
|
|
|
res.Header.Set("Location", locationRewrite)
|