Does Capacitor HTTP plugin bypass WebView cache consistently across iOS and Android?
24.5K reputation · 04 Dec 2024, 21:14 UTC
In a Capacitor application, developers often face inconsistencies when the WebView serves stale data despite Cache-Control: no-cache headers. To resolve this, the Capacitor HTTP plugin can be used to shift network requests from the browser's fetch or XHR APIs to the native OS networking libraries.
While native requests generally bypass the internal WebView cache, there is uncertainty regarding how different OS versions handle these requests when specific cache headers are present in the server response. This shift also impacts CORS restrictions and cookie management, as the requests no longer originate from the browser context.
Which specific behaviors differ between the native HTTP plugin and the WebView's networking stack regarding cache invalidation? Does the native plugin ignore all browser-level caching policies, or does it adhere to native OS-level caching mechanisms?