Every other browser understands when I say:
add_header Content-Security-Policy default-src 'self'; script-src 'self' unsafe-inline; connect-src wss://mysite.com;
In my headers. But Safari says:
Refused to connect to wws://mysite because it doesn't not appear in the connect-src directive in Content Security Policy. [Error] SecurityError (DOM Exception 18): The operation is insecure. (anonymous function) (myjavascripturl.js)
Why does Safari not understand my Content-Security-Policy headers?
In the policy you have provided there are no single quotes around unsafe-inline which are required. Change this:
add_header Content-Security-Policy default-src 'self'; script-src 'self' unsafe-inline; connect-src wss://mysite.com;
To this:
add_header Content-Security-Policy default-src 'self'; script-src 'self' 'unsafe-inline'; connect-src wss://mysite.com;
-------------------------------------------------------------------------^-------------^
That could be affecting the parsing of the policy.
The other concern is in the error message you provided.
Refused to connect to wws://mysite
-----------------------^
Do you have a typo somewhere in your code, should this be wss?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With