SCP (Security Content Policy) issue with pouchdb

烈酒焚心 提交于 2019-12-24 18:04:08

问题


I see an error in the console when running my ionic app on my android device:

Refused to connect to 'blob:http%3A//192.168.0.12%3A8100/9d72a06a-c6fa-4397-976c-41ea23f90be0' 
because it violates the following Content Security Policy directive:
"default-src *". Note that 'connect-src' was not explicitly set,
so 'default-src' is used as a fallback.
i @ pouchdb.min.js:9
(index):28 Uncaught SecurityError: Failed to execute 'open' on 
'XMLHttpRequest': Refused to connect to 'blob:http%3A//192.168.0.12%3A8100/9d72a06a-c6fa-4397-976c-41ea23f90be0' 
because it violates the document's Content Security Policy. 
http://192.168.0.12:8100/lib/pouchdb/dist/pouchdb.min.js Line: 9console.(anonymous function) @ (index):28

It seems to be related to te Content-Security-Policy, can you help me tune it so it works fine please ?

Thanks. My current policy:

index.html:

<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; script-src 'self' 'unsafe-inline' 'unsafe-eval' *">

回答1:


For everyone who's looking for a solution to this error, @beaver's comment worked for me.

I've added this:

connect-src * blob:;

I've also added a * to allow other connections



来源:https://stackoverflow.com/questions/34807901/scp-security-content-policy-issue-with-pouchdb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!