6767XForwardedPrefix string
6868SecureBackend bool
6969enforceRegex bool
70+ pathType networking.PathType
7071}{
7172"when secure backend enabled" : {
7273"/" ,
7879"" ,
7980true ,
8081false ,
82+ networking .PathTypePrefix ,
8183},
8284"when secure backend and dynamic config enabled" : {
8385"/" ,
8991"" ,
9092true ,
9193false ,
94+ networking .PathTypePrefix ,
9295},
9396"when secure backend, stickiness and dynamic config enabled" : {
9497"/" ,
@@ -100,6 +103,7 @@ var (
100103"" ,
101104true ,
102105false ,
106+ networking .PathTypePrefix ,
103107},
104108"invalid redirect / to / with dynamic config enabled" : {
105109"/" ,
@@ -111,6 +115,7 @@ var (
111115"" ,
112116false ,
113117false ,
118+ networking .PathTypePrefix ,
114119},
115120"invalid redirect / to /" : {
116121"/" ,
@@ -122,6 +127,7 @@ var (
122127"" ,
123128false ,
124129false ,
130+ networking .PathTypePrefix ,
125131},
126132"redirect / to /jenkins" : {
127133"/" ,
@@ -137,6 +143,7 @@ proxy_pass $scheme://upstream_balancer;`,
137143"" ,
138144false ,
139145true ,
146+ networking .PathTypePrefix ,
140147},
141148"redirect / to /something with sticky enabled" : {
142149"/" ,
@@ -152,6 +159,7 @@ proxy_pass $scheme://upstream_balancer;`,
152159"" ,
153160false ,
154161true ,
162+ networking .PathTypePrefix ,
155163},
156164"redirect / to /something with sticky and dynamic config enabled" : {
157165"/" ,
@@ -167,6 +175,7 @@ proxy_pass $scheme://upstream_balancer;`,
167175"" ,
168176false ,
169177true ,
178+ networking .PathTypePrefix ,
170179},
171180"add the X-Forwarded-Prefix header" : {
172181"/there" ,
@@ -184,6 +193,7 @@ proxy_pass $scheme://upstream_balancer;`,
184193"/there" ,
185194false ,
186195true ,
196+ networking .PathTypePrefix ,
187197},
188198"use ~* location modifier when ingress does not use rewrite/regex target but at least one other ingress does" : {
189199"/something" ,
@@ -195,6 +205,19 @@ proxy_pass $scheme://upstream_balancer;`,
195205"" ,
196206false ,
197207true ,
208+ networking .PathTypePrefix ,
209+ },
210+ "exact paths should remain exact when enforce regex is enabled" : {
211+ "/something" ,
212+ "/something" ,
213+ `~* "^/something$"` ,
214+ "proxy_pass http://upstream_balancer;" ,
215+ "proxy_pass $scheme://upstream_balancer;" ,
216+ false ,
217+ "" ,
218+ false ,
219+ true ,
220+ networking .PathTypeExact ,
198221},
199222}
200223)
@@ -319,7 +342,7 @@ func TestBuildLocation(t *testing.T) {
319342for k , tc := range tmplFuncTestcases {
320343loc := & ingress.Location {
321344Path : tc .Path ,
322- PathType : & pathPrefix ,
345+ PathType : & tc . pathType ,
323346Rewrite : rewrite.Config {Target : tc .Target },
324347}
325348
0 commit comments