-
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
bug: Android: cookie handling for proxied requests + avoid creating a new connection to check the contentType #2831
Comments
can you send a pull request with the changes? |
I created a pull request. Hope i made no mistake. |
There is still the needs-reply label on this issue. |
Sorry, I forgot to remove the label. |
I added a zip with the capacitor config and a test server in node that delivers a simple page that will set and check the cookie. Because you need a https connection to call this server from the android webview a quick solution is using a "tunneling service" like ngrok. Download and start ngrok: Start the node server via: node server.js Then enter the ngrok https address in capacitor.config.json and build a new android app. Hope this is enough input. |
It is possible to merge the pull request. I think the changes are marginal and will result in a better "connection and cookie handling". Currently for all get requests a new connection is opened to check the contentType for "text/html" This is not really needed because the header of the request still contains the contentType. Also the cookie is saved to the CookieManager when the server sends new cookies via the "Set-Cookie" header. Due to this bug i must always patch my local installation after a fresh "npm install" which is very inconvenient. |
@IlCallo yes i think this is the same issue. Please merge my pull request so i can use you great capacitor project without patching ;-) |
Thanks for merging ! |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out. |
Bug Report
Capacitor Version
master
Affected Platform(s)
Current Behavior
When using the "server.url" parameter in the capacitor.config.json to retrieve the app data from an external server incoming cookies are not saved to the CookieManager. Also an additional connection is opened in handleProxyRequest to check the contentType.
see: WebViewLocalServer:handleProxyRequest
see: JSInjector:getInjectedStream
My scenario:
Currently I use capacitor to add a native barcode scanner to my PWA app.
When running as simple PWA, the "browser camera api" is used, but when running in the capacitor app the native barcode scanner should be used.
Therefore capacitor seems to be the perfect framework.
But currently i have the described problem when the authentication cookie should be saved.
I would be happy if my change would be included in the project.
Expected Behavior
save incoming cookies (also when getting text/html files)
Sample Code or Sample Application Repo
see fix.zip
Reproduction Steps
fix.zip
Other Technical Details
Other Information
The text was updated successfully, but these errors were encountered: