Refactor handling of path Prefix and Exact
This commit is contained in:
parent
52726abaee
commit
3f153add00
10 changed files with 316 additions and 71 deletions
|
|
@ -317,26 +317,16 @@ func locationConfigForLua(l interface{}, a interface{}) string {
|
|||
return "{}"
|
||||
}
|
||||
|
||||
pathType := ""
|
||||
if location.PathType != nil {
|
||||
pathType = fmt.Sprintf("%v", *location.PathType)
|
||||
}
|
||||
if needsRewrite(location) || location.Rewrite.UseRegex {
|
||||
pathType = ""
|
||||
}
|
||||
|
||||
return fmt.Sprintf(`{
|
||||
force_ssl_redirect = %t,
|
||||
ssl_redirect = %t,
|
||||
force_no_ssl_redirect = %t,
|
||||
use_port_in_redirects = %t,
|
||||
path_type = "%v",
|
||||
}`,
|
||||
location.Rewrite.ForceSSLRedirect,
|
||||
location.Rewrite.SSLRedirect,
|
||||
isLocationInLocationList(l, all.Cfg.NoTLSRedirectLocations),
|
||||
location.UsePortInRedirects,
|
||||
pathType,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -417,7 +407,7 @@ func buildLocation(input interface{}, enforceRegex bool) string {
|
|||
}
|
||||
|
||||
if location.PathType != nil && *location.PathType == networkingv1beta1.PathTypeExact {
|
||||
return fmt.Sprintf(`~ ^%s$`, path)
|
||||
return fmt.Sprintf(`= %s`, path)
|
||||
}
|
||||
|
||||
return path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue