67
67
XForwardedPrefix string
68
68
SecureBackend bool
69
69
enforceRegex bool
70
+ pathType networking.PathType
70
71
}{
71
72
"when secure backend enabled" : {
72
73
"/" ,
78
79
"" ,
79
80
true ,
80
81
false ,
82
+ networking .PathTypePrefix ,
81
83
},
82
84
"when secure backend and dynamic config enabled" : {
83
85
"/" ,
89
91
"" ,
90
92
true ,
91
93
false ,
94
+ networking .PathTypePrefix ,
92
95
},
93
96
"when secure backend, stickiness and dynamic config enabled" : {
94
97
"/" ,
@@ -100,6 +103,7 @@ var (
100
103
"" ,
101
104
true ,
102
105
false ,
106
+ networking .PathTypePrefix ,
103
107
},
104
108
"invalid redirect / to / with dynamic config enabled" : {
105
109
"/" ,
@@ -111,6 +115,7 @@ var (
111
115
"" ,
112
116
false ,
113
117
false ,
118
+ networking .PathTypePrefix ,
114
119
},
115
120
"invalid redirect / to /" : {
116
121
"/" ,
@@ -122,6 +127,7 @@ var (
122
127
"" ,
123
128
false ,
124
129
false ,
130
+ networking .PathTypePrefix ,
125
131
},
126
132
"redirect / to /jenkins" : {
127
133
"/" ,
@@ -137,6 +143,7 @@ proxy_pass $scheme://upstream_balancer;`,
137
143
"" ,
138
144
false ,
139
145
true ,
146
+ networking .PathTypePrefix ,
140
147
},
141
148
"redirect / to /something with sticky enabled" : {
142
149
"/" ,
@@ -152,6 +159,7 @@ proxy_pass $scheme://upstream_balancer;`,
152
159
"" ,
153
160
false ,
154
161
true ,
162
+ networking .PathTypePrefix ,
155
163
},
156
164
"redirect / to /something with sticky and dynamic config enabled" : {
157
165
"/" ,
@@ -167,6 +175,7 @@ proxy_pass $scheme://upstream_balancer;`,
167
175
"" ,
168
176
false ,
169
177
true ,
178
+ networking .PathTypePrefix ,
170
179
},
171
180
"add the X-Forwarded-Prefix header" : {
172
181
"/there" ,
@@ -184,6 +193,7 @@ proxy_pass $scheme://upstream_balancer;`,
184
193
"/there" ,
185
194
false ,
186
195
true ,
196
+ networking .PathTypePrefix ,
187
197
},
188
198
"use ~* location modifier when ingress does not use rewrite/regex target but at least one other ingress does" : {
189
199
"/something" ,
@@ -195,6 +205,19 @@ proxy_pass $scheme://upstream_balancer;`,
195
205
"" ,
196
206
false ,
197
207
true ,
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 ,
198
221
},
199
222
}
200
223
)
@@ -319,7 +342,7 @@ func TestBuildLocation(t *testing.T) {
319
342
for k , tc := range tmplFuncTestcases {
320
343
loc := & ingress.Location {
321
344
Path : tc .Path ,
322
- PathType : & pathPrefix ,
345
+ PathType : & tc . pathType ,
323
346
Rewrite : rewrite.Config {Target : tc .Target },
324
347
}
325
348
0 commit comments