RESOLVED FIXED 264388
Safari adds pragma header to Service Worker requests with active Service Worker
https://bugs.webkit.org/show_bug.cgi?id=264388
Summary Safari adds pragma header to Service Worker requests with active Service Worker
Daniel Schulz
Reported 2023-11-08 00:34:50 PST
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
Attachments
Demo to reproduce the issue (1.34 KB, application/zip)
2023-11-08 00:34 PST, Daniel Schulz
no flags
Radar WebKit Bug Importer
Comment 1 2023-11-15 00:35:21 PST
youenn fablet
Comment 2 2023-11-15 07:28:46 PST
EWS
Comment 3 2023-11-16 01:24:49 PST
Committed 270819@main (900625097b70): <https://commits.webkit.org/270819@main> Reviewed commits have been landed. Closing PR #20538 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.