fixed rewrites for paths not ending in /
This commit is contained in:
parent
cb96cf0fcc
commit
e428095e3c
3 changed files with 17 additions and 8 deletions
|
|
@ -470,7 +470,6 @@ func buildProxyPass(host string, b interface{}, loc interface{}, dynamicConfigur
|
|||
var xForwardedPrefix string
|
||||
|
||||
if location.Rewrite.AddBaseURL {
|
||||
// path has a slash suffix, so that it can be connected with baseuri directly
|
||||
bPath := fmt.Sprintf("%s$escaped_base_uri", path)
|
||||
regex := `(<(?:H|h)(?:E|e)(?:A|a)(?:D|d)(?:[^">]|"[^"]*")*>)`
|
||||
scheme := "$scheme"
|
||||
|
|
@ -494,15 +493,16 @@ subs_filter '%v' '$1<base href="%v://$http_host%v">' ro;
|
|||
// ie /something to /
|
||||
return fmt.Sprintf(`
|
||||
rewrite (?i)%s(.*) /$1 break;
|
||||
rewrite (?i)%s / break;
|
||||
rewrite (?i)%s$ / break;
|
||||
%v%v %s%s;
|
||||
%v`, path, location.Path, xForwardedPrefix, proxyPass, proto, upstreamName, abu)
|
||||
}
|
||||
|
||||
return fmt.Sprintf(`
|
||||
rewrite (?i)%s(.*) %s/$1 break;
|
||||
rewrite (?i)%s$ %s/ break;
|
||||
%v%v %s%s;
|
||||
%v`, path, location.Rewrite.Target, xForwardedPrefix, proxyPass, proto, upstreamName, abu)
|
||||
%v`, path, location.Rewrite.Target, location.Path, location.Rewrite.Target, xForwardedPrefix, proxyPass, proto, upstreamName, abu)
|
||||
}
|
||||
|
||||
// default proxy_pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue