Commit 4e44dbc
authored
[Scaler] Fix path duplication for request http (#82)
### 📝 Description
The changes simplify the handler logic by removing redundant path
handling and ensuring that path additions are only applied when
explicitly provided via headers.
---
### 🛠️ Changes Made
- Replaced `getPathAndResourceNames` in favor of a simplified
`getResourceNames`.
- Updated `handleRequest` to extract `pathAddition` only from the
pre-configured handler's `targetPathHeader`.
- Adjusted cache lookup functions to return only `resourceNames` instead
of `(path, resourceNames)`.
---
### ✅ Checklist
- [x] I have tested the changes in this PR
---
### 🧪 Testing
- Dev QA
- Created a function that prints the `event.path`
- Triggered the function with this command:
`curl print-path.default-tenant.app.vmdev5.lab.iguazeng.com/a/b`
- **Before changes:**
`"name":"processor.http.w0.python.logger.connection-manager.event","message":"Request
path","more":{"path":"/a/b/a/b"}}`
- **After changes:**
`"name":"processor.http.w0.python.logger.connection-manager.event","message":"Request
path","more":{"path":"/a/b"}}`
- Updated UTs and added more cases coverage
---
### 🔗 References
- Ticket link: https://iguazio.atlassian.net/browse/NUC-602
- Design docs links:
- External links: The second path append happens
[here](https://cs.opensource.google/go/go/+/refs/tags/go1.25.1:src/net/http/httputil/reverseproxy.go;l=275)
---
### 🚨 Breaking Changes?
- [ ] Yes (explain below)
- [x] No
<!-- If yes, describe what needs to be changed downstream: -->
---
### 🔍️ Additional Notes
- Need to discuss weather we still want to support `targetPathHeader`
[[link](https://github.com/v3io/scaler/blob/development/pkg/dlx/handler.go#L47)]1 parent 01b3274 commit 4e44dbc
2 files changed
+42
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | 82 | | |
84 | 83 | | |
85 | 84 | | |
| |||
100 | 99 | | |
101 | 100 | | |
102 | 101 | | |
103 | | - | |
| 102 | + | |
104 | 103 | | |
105 | 104 | | |
106 | 105 | | |
| |||
109 | 108 | | |
110 | 109 | | |
111 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
112 | 114 | | |
113 | | - | |
| 115 | + | |
114 | 116 | | |
115 | 117 | | |
116 | 118 | | |
| |||
166 | 168 | | |
167 | 169 | | |
168 | 170 | | |
169 | | - | |
170 | | - | |
171 | | - | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
172 | 174 | | |
173 | | - | |
| 175 | + | |
174 | 176 | | |
175 | 177 | | |
176 | 178 | | |
| |||
180 | 182 | | |
181 | 183 | | |
182 | 184 | | |
183 | | - | |
184 | 185 | | |
185 | | - | |
| 186 | + | |
186 | 187 | | |
187 | 188 | | |
188 | | - | |
| 189 | + | |
189 | 190 | | |
190 | 191 | | |
191 | | - | |
| 192 | + | |
192 | 193 | | |
193 | 194 | | |
194 | 195 | | |
195 | 196 | | |
196 | | - | |
| 197 | + | |
197 | 198 | | |
198 | 199 | | |
199 | 200 | | |
200 | | - | |
| 201 | + | |
201 | 202 | | |
202 | 203 | | |
203 | | - | |
| 204 | + | |
204 | 205 | | |
205 | 206 | | |
206 | 207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
140 | 161 | | |
141 | 162 | | |
142 | 163 | | |
| |||
166 | 187 | | |
167 | 188 | | |
168 | 189 | | |
169 | | - | |
170 | 190 | | |
171 | 191 | | |
172 | 192 | | |
| |||
178 | 198 | | |
179 | 199 | | |
180 | 200 | | |
181 | | - | |
182 | 201 | | |
183 | 202 | | |
184 | 203 | | |
185 | 204 | | |
186 | 205 | | |
187 | | - | |
188 | 206 | | |
189 | 207 | | |
190 | 208 | | |
| |||
209 | 227 | | |
210 | 228 | | |
211 | 229 | | |
212 | | - | |
213 | 230 | | |
214 | 231 | | |
215 | 232 | | |
| |||
230 | 247 | | |
231 | 248 | | |
232 | 249 | | |
233 | | - | |
| 250 | + | |
234 | 251 | | |
235 | 252 | | |
236 | 253 | | |
237 | 254 | | |
238 | 255 | | |
239 | 256 | | |
240 | 257 | | |
241 | | - | |
242 | 258 | | |
243 | 259 | | |
244 | 260 | | |
| |||
308 | 324 | | |
309 | 325 | | |
310 | 326 | | |
311 | | - | |
| 327 | + | |
| 328 | + | |
312 | 329 | | |
313 | 330 | | |
314 | 331 | | |
| |||
0 commit comments