Fix proactive caching failing on HTTP->HTTPS redirects

The background dependency caching was getting 308 redirects because
request.base_url returns http:// but the ingress redirects to https://.

Enable follow_redirects=True in httpx client to handle this.
This commit is contained in:
Mondo Diaz
2026-01-30 18:11:08 -06:00
parent c1060feb5f
commit 522d23ec01

View File

@@ -528,7 +528,7 @@ def _cache_dependency_background(
simple_url = f"{base_url}/pypi/simple/{normalized_name}/"
logger.info(f"PyPI proxy: proactively caching {dep_name} (depth={depth})")
with httpx.Client(timeout=30.0) as client:
with httpx.Client(timeout=30.0, follow_redirects=True) as client:
response = client.get(simple_url)
if response.status_code != 200:
logger.warning(f"PyPI proxy: failed to get index for {dep_name}: {response.status_code}")