Fix proactive dependency caching HTTPS redirect issue
When background threads fetch from our own proxy using the request's base_url, it returns http:// but ingress requires https://. The 308 redirect was dropping trailing slashes, causing requests to hit the frontend catch-all route instead of /pypi/simple/. Force HTTPS explicitly in the background caching function to avoid the redirect entirely.
This commit is contained in:
@@ -525,6 +525,9 @@ def _cache_dependency_background(
|
||||
normalized_name = re.sub(r'[-_.]+', '-', dep_name).lower()
|
||||
|
||||
# First, get the simple index page to find available versions
|
||||
# Use HTTPS explicitly to avoid redirect issues that can drop trailing slashes
|
||||
if base_url.startswith('http://'):
|
||||
base_url = 'https://' + base_url[7:]
|
||||
simple_url = f"{base_url}/pypi/simple/{normalized_name}/"
|
||||
logger.info(f"PyPI proxy: proactively caching {dep_name} (depth={depth})")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user