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:
@@ -528,7 +528,7 @@ def _cache_dependency_background(
|
|||||||
simple_url = f"{base_url}/pypi/simple/{normalized_name}/"
|
simple_url = f"{base_url}/pypi/simple/{normalized_name}/"
|
||||||
logger.info(f"PyPI proxy: proactively caching {dep_name} (depth={depth})")
|
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)
|
response = client.get(simple_url)
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
logger.warning(f"PyPI proxy: failed to get index for {dep_name}: {response.status_code}")
|
logger.warning(f"PyPI proxy: failed to get index for {dep_name}: {response.status_code}")
|
||||||
|
|||||||
Reference in New Issue
Block a user