-
Notifications
You must be signed in to change notification settings - Fork 396
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
feat(ios): add http(s) proxy/scheme #448
base: master
Are you sure you want to change the base?
Conversation
If this feature is usefull and gets merged, the documentation needs to be updated probably here: https://beta.ionicframework.com/docs/building/webview#file-protocol ? |
I'm running tests over iOS 13.1.2 and the cookies doesn't reach the server in fetch requests, i.e. |
You must use the |
This was done with some suggestions from @jcesarmobile . Do you have any comments on the implementation? |
This is the corresponding documentation that needs to be updated in case this gets merged: https://github.com/ionic-team/ionic-docs/blob/master/src/pages/building/webview.md |
Seems like #376 is the Android version of this change. Adding this feature may mean integrating both PRs. |
6a391dd
to
e29f6cd
Compare
This adds a new URLSchemeHandler which can proxy http(s) requests to external servers. This is useful for some CORS issues and webview bugs that affect the use of cookies in CORS requests via XHR and fetch. For that reason cookies will be synced between proxied requests on the native layer and the webview.
e29f6cd
to
6374b87
Compare
I just rebased and resolved conflicts with cbd526d |
Documentation needs to be updated. For basic instrutions see this: #475 (comment) |
@jcesarmobile Do you see any chances this could be merged? I don't know how relevant this is for the upstream plugin, but I try to mimize forked plugins in our app. I now know this breaks Anroid currently. |
Proxying http and https via `convertFileSrc` only works on Android where the webview runs on custom schemes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NiklasMerz it might be good idea keep the boolean check first in IF statement
if (convertHttp && url.startsWith('http://'))
AND
if (convertHttp && url.startsWith('https://'))
What do you think?
I tried running this, and it seems to reliably crash my iOS app. Not sure how to provide more info. |
@alexsasharegan You could open you iOS platform in Xcode and run it from there on an iPhone. If the app crashes, you should see an error in the Xcode consoe. |
d3349f7
to
1b3d15c
Compare
@NiklasMerz can you please resolve the conflict and thanks ^_^ |
This adds a new URLSchemeHandler which can proxy http(s) requests to external servers.
This is useful for some CORS issues and webview bugs that affect the use of cookies in CORS requests via XHR and fetch.
See Webkit bug https://bugs.webkit.org/show_bug.cgi?id=200857
For that reason cookies will be synced between proxied requests on the native layer and the webview.