Skip to content

Strip Authorization header on cross-origin redirects#779

Merged
jph00 merged 1 commit intomainfrom
erikgaas/safe_redirect
Feb 27, 2026
Merged

Strip Authorization header on cross-origin redirects#779
jph00 merged 1 commit intomainfrom
erikgaas/safe_redirect

Conversation

@erikgaas
Copy link
Contributor

Fixes 403 errors when urllib follows redirects to external hosts (e.g. GitHub API redirecting to Azure Blob Storage for log downloads).

Adds a custom redirect handler that strips the Authorization header when the redirect target is a different host. This matches standard behavior in requests, httpx, and urllib3 per RFC 7235.

@erikgaas erikgaas requested a review from jph00 February 27, 2026 05:37
@jph00 jph00 added the enhancement New feature or request label Feb 27, 2026
@jph00 jph00 merged commit 7dbe2db into main Feb 27, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants