Skip to content

fix: preserve redirect URLs with async capture host prefixes - #941

Merged
marandaneto merged 1 commit into
PostHog:mainfrom
nickita-khylkouski:fix/async-redirect-host-prefix
Sep 11, 2026
Merged

marandaneto merged 1 commit into
PostHog:mainfrom
nickita-khylkouski:fix/async-redirect-host-prefix

Conversation

@nickita-khylkouski

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

When the configured capture host contains a path prefix, passing relative redirect paths through an HTTPX client can reapply or retain that prefix incorrectly. Resolve each redirect against the current absolute URL, enforce the original origin, and pass absolute URLs through the redirect chain.

💚 How did you test it?

  • Full test suite: 2,502 passed, 15 skipped, 38 subtests passed
  • Full mypy check: 230 source files, no issues
  • Import smoke test and package build
  • Added 307/308 coverage for absolute, root-relative, relative, and query-only redirects with prefixed hosts

The repository-wide Ruff command currently reports existing formatting and legacy-lint findings in untouched files; the modified Python files pass formatting.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran sampo add to generate a changeset file

An equivalent patch changeset is included at .sampo/changesets/async-capture-redirect-path-prefix.md.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

The contributor directed the scope and redirect behavior. Codex helped inspect the repository, apply the bounded change, and run the repository checks; same-origin enforcement remains in place and fragments are not forwarded.

@nickita-khylkouski
nickita-khylkouski requested a review from a team as a code owner September 10, 2026 16:11
@marandaneto

Copy link
Copy Markdown
Member

thanks @nickita-khylkouski

@marandaneto
marandaneto force-pushed the fix/async-redirect-host-prefix branch from c878d10 to a5f94dc Compare September 11, 2026 08:17
@marandaneto
marandaneto enabled auto-merge (squash) September 11, 2026 08:18
@marandaneto
marandaneto merged commit 1cc513f into PostHog:main Sep 11, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants