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?

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

Thanks!

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

Safari Extension: Refused to connect to &lt;site&gt; because it does not appear in the connect-src directive of the Content Security Policy.
 
 
Q