Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(http): pass original url as query param on the proxy url #7527

Merged
merged 10 commits into from
Aug 5, 2024

Conversation

michaelwolz
Copy link
Contributor

@michaelwolz michaelwolz commented Jun 20, 2024

Following up #7523.

This suggestion addresses the issue of non-encoded URLs in patched fetch and XHR requests. By encoding the full original URL and appending it as a parameter to the bridge/proxy URL, this solution should be more robust when passed to the native code. Also, there is no longer a need to distinguish between HTTP and HTTPS URLs separately, as this information is already embedded in the encoded URL parameter.

Working test implementation can be found here (including an example with non 80 port): https://github.com/michaelwolz/capacitor-tests/tree/fix/url-encoding

closes #7585
closes #7523

Copy link
Member

@jcesarmobile jcesarmobile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added some minor comments

ios/Capacitor/Capacitor/CapacitorBridge.swift Show resolved Hide resolved
core/native-bridge.ts Outdated Show resolved Hide resolved
ios/Capacitor/Capacitor/WebViewAssetHandler.swift Outdated Show resolved Hide resolved
@jcesarmobile jcesarmobile changed the title Fix percent-encoding for patched fetch / xhr requests fix(http): pass original url as query param on the proxy url Jul 30, 2024
Copy link
Member

@jcesarmobile jcesarmobile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, cool idea!

Copy link
Member

@Steven0351 Steven0351 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation looks good and I like the reduction in complexity.

@jcesarmobile jcesarmobile merged commit 1da06e6 into ionic-team:main Aug 5, 2024
6 checks passed
jcesarmobile added a commit that referenced this pull request Aug 5, 2024
@michaelwolz michaelwolz deleted the fix/url-encoding branch August 7, 2024 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants