Commit 94611d4
744 dns resolution normalization fix (#745)
* Fix #744: Preserve domain names while preventing localhost duplicates
The normalize_url method was resolving ALL domain names to IP addresses,
which breaks for services behind CDNs, load balancers, or reverse
proxies. This fix:
- Preserves domain names for external services (CDN/load balancer support)
- Only normalizes 127.0.0.1 to localhost to prevent local duplicates
- Maintains fix for issue #649 for localhost/127.0.0.1 duplicates
- Keeps compatibility with PR #712's duplicate prevention for local services
Changes:
- Removed socket.gethostbyname() for external domains
- Added special case to convert 127.0.0.1 to localhost
- Updated tests to verify both behaviors
- Added regression test for duplicate prevention
This balances the needs of both issues:
- #649: Prevent localhost/127.0.0.1 duplicates (still fixed)
- #744: Support services behind CDNs/load balancers (now fixed)
Signed-off-by: Mihai Criveti <[email protected]>
* Fix localhost resolution
Signed-off-by: Mihai Criveti <[email protected]>
* fix pylint
Signed-off-by: RAKHI DUTTA <[email protected]>
---------
Signed-off-by: Mihai Criveti <[email protected]>
Signed-off-by: RAKHI DUTTA <[email protected]>
Co-authored-by: RAKHI DUTTA <[email protected]>1 parent da2e25b commit 94611d4
File tree
2 files changed
+64
-13
lines changed- mcpgateway/services
- tests/unit/mcpgateway/services
2 files changed
+64
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
| |||
257 | 256 | | |
258 | 257 | | |
259 | 258 | | |
260 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
261 | 264 | | |
262 | 265 | | |
263 | 266 | | |
264 | 267 | | |
265 | 268 | | |
266 | | - | |
| 269 | + | |
267 | 270 | | |
268 | 271 | | |
269 | 272 | | |
270 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
271 | 278 | | |
272 | 279 | | |
273 | 280 | | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
283 | 293 | | |
284 | 294 | | |
285 | 295 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1134 | 1134 | | |
1135 | 1135 | | |
1136 | 1136 | | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
1137 | 1178 | | |
1138 | 1179 | | |
1139 | 1180 | | |
| |||
0 commit comments