Skip to content

Conversation

@Gaubee
Copy link
Contributor

@Gaubee Gaubee commented Jan 21, 2026

Problem

When a request's origin matches the target origin but the path is outside the target base path, it could cause path escape issues.

Fix

Added boundary check:

if (normalized.origin === targetBase.origin && normalized.href.startsWith(targetBaseHref) === false) {
  normalized = new URL(normalized.href.replace(normalized.origin, ''), PLACEHOLDER_ORIGIN);
}

This ensures requests that would escape the miniapp's base path are properly rewritten back.

@Gaubee Gaubee merged commit 3692b54 into main Jan 21, 2026
5 checks passed
@Gaubee Gaubee deleted the fix/wujie-url-rewrite-v3 branch January 21, 2026 10:47
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