Bug 233916

Summary: Safari Bug "no-cache" network error
Product: WebKit Reporter: Janos Wartig <janos.wartig>
Component: Service WorkersAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, cdumez, ews-watchlist, japhet, koivisto, webkit-bug-importer, youennf, zach
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Janos Wartig 2021-12-07 00:34:01 PST
A fetch request on the page that sets the cache: "no-cache" will result in a network error when it is fetched by a Service Worker.
The error that is thrown looks like this:
TypeError: Request header field Cache-Control is not allowed by Access-Control-Allow-Headers

I implemented a simple test page that reproduces the issue here: https://testjanos.app.baqend.com/
The test page registers a simple Service Worker which listens to fetch requests and tries to fetch them.
It also includes the following script tag:
	<script>
      let options = { method: "POST", cache: "no-cache", mode: "cors", body: '{"weather":true}' };
	  fetch("https://dcinfos-cache.abtasty.com/v1/geoip", options);
	</script>

Ways to reproduce:
1. Go to https://testjanos.app.baqend.com/
2. Open Service Workers view (Developer -> Service Workers)
3. Refresh the page
4. Observe that resource https://dcinfos-cache.abtasty.com/v1/geoip could not be fetched due to above error (error prited to the Service Worker console)

Is there any fix for this issue?
Comment 1 youenn fablet 2021-12-08 02:32:40 PST
Created attachment 446342 [details]
Patch
Comment 2 Chris Dumez 2021-12-08 07:18:08 PST
Comment on attachment 446342 [details]
Patch

r=me
Comment 3 EWS 2021-12-08 08:01:03 PST
Committed r286655 (244968@main): <https://commits.webkit.org/244968@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 446342 [details].
Comment 4 Radar WebKit Bug Importer 2021-12-08 08:02:24 PST
<rdar://problem/86211355>
Comment 5 youenn fablet 2022-03-14 04:01:31 PDT
*** Bug 236084 has been marked as a duplicate of this bug. ***