Add support for k8s ingress pathtype Prefix

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-10-28 00:22:54 -03:00 committed by Elvin Efendi
parent 340850447f
commit a6b6f03b53
3 changed files with 107 additions and 1 deletions

View file

@ -317,16 +317,26 @@ 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,
)
}