Repository navigation
Commit 4e44c84
fix(client): skip mTLS URL rewriting for multi-regional .rep.googleapis.com endpoints and honor GOOGLE_API_USE_MTLS_ENDPOINT in Google Auth sessions
Multi-regional Vertex AI endpoints (`aiplatform.us.rep.googleapis.com` and `aiplatform.eu.rep.googleapis.com`) do not publish `.rep.mtls.googleapis.com` DNS records. When `GOOGLE_API_USE_CLIENT_CERTIFICATE=true` is set (such as on Vertex AI Agent Engine with `AGENT_IDENTITY=true`), rewriting these URLs in `to_mtls_url()` causes requests to fail with `NXDOMAIN` (`Name or service not known`).
Additionally, `_request_once`, `_async_request_once`, `download_file`, and `async_download_file` previously checked `session._is_mtls` directly when using `AuthorizedSession` / `AsyncAuthorizedSession`, bypassing `_use_mtls_endpoint()` and ignoring `GOOGLE_API_USE_MTLS_ENDPOINT=never`.
- Update `to_mtls_url()` to leave multi-regional `.us.rep.` and `.eu.rep.` endpoints unchanged while continuing to rewrite single-region `.rep.` endpoints.
- Gate `to_mtls_url()` in the synchronous and asynchronous Google Auth session paths via `self._use_mtls_endpoint(client_cert_loaded=...)`.
PiperOrigin-RevId: 10042137571 parent d6af6cd commit 4e44c84
2 files changed
Lines changed: 124 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
233 | 240 | | |
234 | 241 | | |
235 | 242 | | |
236 | 243 | | |
237 | 244 | | |
238 | | - | |
239 | | - | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
240 | 249 | | |
241 | 250 | | |
242 | 251 | | |
243 | | - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
244 | 258 | | |
245 | 259 | | |
246 | 260 | | |
| |||
1600 | 1614 | | |
1601 | 1615 | | |
1602 | 1616 | | |
1603 | | - | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
1604 | 1620 | | |
1605 | 1621 | | |
1606 | 1622 | | |
| |||
1677 | 1693 | | |
1678 | 1694 | | |
1679 | 1695 | | |
1680 | | - | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
1681 | 1699 | | |
1682 | 1700 | | |
1683 | 1701 | | |
| |||
1749 | 1767 | | |
1750 | 1768 | | |
1751 | 1769 | | |
1752 | | - | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
1753 | 1773 | | |
1754 | 1774 | | |
1755 | 1775 | | |
| |||
2162 | 2182 | | |
2163 | 2183 | | |
2164 | 2184 | | |
2165 | | - | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
2166 | 2188 | | |
2167 | 2189 | | |
2168 | 2190 | | |
| |||
2531 | 2553 | | |
2532 | 2554 | | |
2533 | 2555 | | |
2534 | | - | |
| 2556 | + | |
| 2557 | + | |
| 2558 | + | |
2535 | 2559 | | |
2536 | 2560 | | |
2537 | 2561 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2074 | 2074 | | |
2075 | 2075 | | |
2076 | 2076 | | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
| 2096 | + | |
2077 | 2097 | | |
2078 | 2098 | | |
2079 | 2099 | | |
| |||
2392 | 2412 | | |
2393 | 2413 | | |
2394 | 2414 | | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
| 2480 | + | |
| 2481 | + | |
| 2482 | + | |
| 2483 | + | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
0 commit comments