From 5587f1048729f16968242ff9cd06328ea69737e6 Mon Sep 17 00:00:00 2001 From: Roman Musin Date: Mon, 26 Apr 2021 14:45:31 +0100 Subject: [PATCH] All: Fixes #4706: Disable WebDAV response caching (#4887) --- packages/lib/WebDavApi.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/lib/WebDavApi.js b/packages/lib/WebDavApi.js index 87a904058d..6fec2b81a6 100644 --- a/packages/lib/WebDavApi.js +++ b/packages/lib/WebDavApi.js @@ -352,6 +352,13 @@ class WebDavApi { if (method === 'PUT') headers['Content-Type'] = 'text/plain'; } + // React-native has caching enabled by at least on Android (see https://github.com/laurent22/joplin/issues/4706 and the related PR). + // The below header disables caching for all versions, including desktop. + // This can potentially also help with misconfigured caching on WebDAV server. + if (!headers['Cache-Control']) { + headers['Cache-Control'] = 'no-store'; + } + // On iOS, the network lib appends a If-None-Match header to PROPFIND calls, which is kind of correct because // the call is idempotent and thus could be cached. According to RFC-7232 though only GET and HEAD should have // this header for caching purposes. It makes no mention of PROPFIND.