Created attachment 468512 [details] Demo to reproduce the issue Steps to Reproduce: 1) Start a server with the attached files: `index.html`, `script.js`, `sw.js` 2) open index.html, open Dev Tools network tab and console. Disable Cache in Dev Tools. 3) click button to fetch asset -> Asset is fetched normally 4) click button to register Service Worker, reload page to ensure Service Worker is active 5) click fetch button again. This should try to fetch the asset through the Service Worker 6) Fetch fails Details to the steps to reproduce: The server responding to the request needs to disallow the deprecated pragma header. When fetching a request through a Service Worker, Safari adds a pragma header to the request. In order to check if the pragma header is allowed on the server, it sends a preflight request, which is then responded to negatively by our test server. This will let the fetch fail. The actual unexpected behaviour is in the difference in fetching with vs without the Service Worker. I would expect the fetch to behave the same regardless. The fetch fails with the error: `Failed to load resource: Request header field Pragma is not allowed by Access-Control-Allow-Headers`, as seen in the Service Worker's Network Tab. Expected Results: Actual Results: The fetch fails with active Service Worker. Observed Results: Version: The fetch works with active Service Worker. Tested Versions: Notes: Safari 17/MacOS Sonoma, Safari TP/MacOS Sonoma
<rdar://problem/118442076>
Pull request: https://github.com/WebKit/WebKit/pull/20538
Committed 270819@main (900625097b70): <https://commits.webkit.org/270819@main> Reviewed commits have been landed. Closing PR #20538 and removing active labels.