All: Fixes #4706: Disable WebDAV response caching (#4887)

pull/4903/head
Roman Musin 2021-04-26 14:45:31 +01:00 committed by GitHub
parent 34540ed30a
commit 5587f10487
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -352,6 +352,13 @@ class WebDavApi {
if (method === 'PUT') headers['Content-Type'] = 'text/plain'; 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 // 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 // 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. // this header for caching purposes. It makes no mention of PROPFIND.