-
Notifications
You must be signed in to change notification settings - Fork 1k
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): route get requests through custom handler #6818
Conversation
|
android/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java
Outdated
Show resolved
Hide resolved
android/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java
Outdated
Show resolved
Hide resolved
android/capacitor/src/main/java/com/getcapacitor/plugin/util/HttpRequestHandler.java
Outdated
Show resolved
Hide resolved
android/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java
Outdated
Show resolved
Hide resolved
android/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java
Outdated
Show resolved
Hide resolved
…k to native bridge, cleanup swift force unwraps
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.
can you resolve the conflicts?
.replacingOccurrences(of: CapacitorBridge.httpsInterceptorStartIdentifier, with: "") | ||
|
||
// Only replace first occurrence of the scheme | ||
if let range = targetUrl.range(of: self.serverUrl?.scheme ?? InstanceDescriptorDefaults.scheme) { |
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.
if let range = targetUrl.range(of: self.serverUrl?.scheme ?? InstanceDescriptorDefaults.scheme) { | |
if let range = targetUrl.range(of: localUrl.scheme ?? InstanceDescriptorDefaults.scheme) { |
should replace the localUrl scheme, not the serverUrl scheme, because when using live reload serverUrl scheme is http, but proxy urls are capacitor (or the configured scheme)
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.
Added a few comments.
Also, I've noticed that the proxy urls look like this capacitor://localhost//
, with a double /
at the end. Is that intended? I've read that while double /
are accepted by servers they can cause problems on the browsers.
It wasn't intentional. I didn't notice any side effects, but I changed it to be safe |
android/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java
Outdated
Show resolved
Hide resolved
android/capacitor/src/main/java/com/getcapacitor/WebViewLocalServer.java
Outdated
Show resolved
Hide resolved
Any idea if this fix will be included in an upcoming release sometime soon? My org is in the middle of migrating a large scale Cordova application to Capacitor. As far as we can tell, this is the last issue blocking us. We download image blobs and store them in SQLite so we can display them without an internet connection. |
Co-authored-by: jcesarmobile <[email protected]> Co-authored-by: Mark Anderson <[email protected]>
Closes #6123
Closes #6126
This PR routes fetch/XHR request methods (when
CapacitorHttp
is enabled) that don't allow bodies (GET
,OPTIONS
,HEAD
,TRACE
) to native protocol handlers so the responses don't have to be encoded/decoded through the bridge.Opened in favor of outdated #6540
Test app: https://github.com/ItsChaceD/capacitor-http-wasm-issue