Bug 236973 - Missing content type header for requests with non-safe content type
Summary: Missing content type header for requests with non-safe content type
Status: RESOLVED DUPLICATE of bug 236837
Alias: None
Product: WebKit
Classification: Unclassified
Component: Service Workers (show other bugs)
Version: Safari 15
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-02-21 06:31 PST by Kevin Twesten
Modified: 2022-03-10 05:13 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Twesten 2022-02-21 06:31:01 PST
When sending a request with a non-safe content type (e.g. a blob via sendBeacon), the "content-type" header is missing when it is fetched by a Service Worker.
This happens for cross-origin requests as well as for same-origin requests.

I implemented a simple test page that reproduces the issue here: https://good-breeze-16.app.baqend.com/
The test page registers a simple Service Worker which listens to fetch requests, logs the seen request headers, and does the fetch.
The test page also includes the following script tag that sends the beacon requests:
	<script>
	   // Cross Origin
           var blob = new Blob([JSON.stringify({"weather":true})], { type: "application/json" });
           navigator.sendBeacon('https://dm-clone.app.baqend.com/v1/code/endpoint?type=beaconStrange', blob);
           // Same origin
           var blob = new Blob([JSON.stringify({"weather":true})], { type: "application/json" });
           navigator.sendBeacon('https://good-breeze-16.app.baqend.com/v1/code/endpoint?type=beaconStrange', blob);
	</script>

Ways to reproduce:
1. Navigate to https://good-breeze-16.app.baqend.com/
2. Open Service Workers view (Developer -> Service Workers)
3. Refresh the page
4. Check the request headers printed in the Service Worker console and see that the "content-type" header is missing for both beacon requests.


Is there any fix for this issue?
Comment 1 Radar WebKit Bug Importer 2022-02-23 15:39:23 PST
<rdar://problem/89382511>
Comment 2 youenn fablet 2022-03-10 05:13:09 PST

*** This bug has been marked as a duplicate of bug 236837 ***
Comment 3 youenn fablet 2022-03-10 05:13:35 PST
> Is there any fix for this issue?

Thanks for the report, this should be fixed now in ToT.