Safari Extension: Refused to connect to <site> because it does not appear in the connect-src directive of the Content Security Policy.

I'm trying to make a request using fetch to my api inside a safari extension background page. This is a manifest v3 extension converted from a chrome extension (which works). Inspecting the background page, I see an error message which reads Refused to connect to <site> because it does not appear in the connect-src directive of the Content Security Policy. I have tried setting a policy for default-src and connect-src in the extension_pages field of the content_security_policy key in the manifest.json file, but the error persists.

How can I make a fetch request to an api in a background page?

Post not yet marked as solved Up vote post of mark-hudson Down vote post of mark-hudson
1.3k views

Replies

This should be fixed in the latest version of Safari Technology Preview. Can you test there and let us know your findings?

Thanks!

  • I've not sure if this test fix is still live in Safari Technology Preview-- but I'm still experiencing this problem, tested on version 161.

  • @bweinstein Please answer here. Still facing this problem in Safari 16.5

Add a Comment

Hi! Any news on this? I'm having the same problem as OP, and I also tried latest Safari Technology Preview and error still persists there? Any workaround for this or is it going to be fixed in Safari soon?

This is still not fixed in 17.0... I couldn't find a fix anywhere.

is this fixed I'm having a similar issue