Bug 213726 - fetch fails only when site/pwa is added to homescreen
Summary: fetch fails only when site/pwa is added to homescreen
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: Safari 13
Hardware: iPhone / iPad iOS 13
: P2 Major
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-06-29 07:18 PDT by mustafa.0x
Modified: 2020-07-05 14:00 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mustafa.0x 2020-06-29 07:18:54 PDT
I have a PWA (http://app.turath.io) that loads a JSON file from another subdomain.

This works fine in Safari iOS, but it fails once I add the site to homescreen.

The error message:
> Fetch API cannot load https://files.turath.io/data.json due to access control checks.
> Failed to load resource: Preflight response is not successful

This only recently broke.
Comment 1 Hossameldin 2020-06-29 18:10:44 PDT
I have a similar situation 
Very important to fix
Comment 2 mustafa.0x 2020-06-30 15:46:42 PDT
Note: I updated the service worker to ignore this fetch, and that *seems* to have fixed the issue.

If so, the bug is with the sw's proxying.


The change I made to the service worker:
 self.addEventListener('fetch', e => {
+    if (e.request.url === 'https://files.turath.io/data.json')
+        return;
     e.respondWith(caches.match(e.request).then(r => r || fetch(e.request)));
 });
Comment 3 Radar WebKit Bug Importer 2020-07-05 14:00:02 PDT
<rdar://problem/65110679>