Patching redirection bug

+ Added wip basic auth editor custom exception rules
+ Added custom logic to handle apache screw up redirect header
This commit is contained in:
Toby Chui
2023-08-20 14:50:25 +08:00
parent 70adadf129
commit a3d55a3274
5 changed files with 36 additions and 6 deletions

View File

@@ -25,7 +25,9 @@ func replaceLocationHost(urlString string, rrr *ResponseRewriteRuleSet, useTLS b
//E.g. Proxy config: blog.example.com -> example.com/blog
//Check if it is actually redirecting to example.com instead of a new domain
//like news.example.com.
if rrr.ProxyDomain != u.Host {
// The later check bypass apache screw up method of redirection header
// e.g. https://imuslab.com -> http://imuslab.com:443
if rrr.ProxyDomain != u.Host && !strings.Contains(u.Host, rrr.OriginalHost+":") {
//New location domain not matching proxy target domain.
//Do not modify location header
return urlString, nil