ionic framework - Cordova Content Security Policy -
i have cordova app , after upgrading (5.0.0) i'm unable call resource @ all. i've added whitelist plugin , added following tag index.html
<meta http-equiv="content-security-policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' *.azure-mobile.net localhost:1337 *.ajax.aspnetcdn.com">
i got following errors:
refused load script 'http://ajax.aspnetcdn.com/ajax/mobileservices/mobileservices.web-1.2.5.min.js' because violates following content security policy directive: "script-src 'self' 'unsafe-inline' 'unsafe-eval' *.azure-mobile.net localhost:1337 *.ajax.aspnetcdn.com".
refused load script 'http://localhost:1337/vorlon.js' because violates following content security policy directive: "script-src 'self' 'unsafe-inline' 'unsafe-eval' *.azure-mobile.net localhost:1337 *.ajax.aspnetcdn.com".
i've tried default policy should allow everything, still no luck.
i've added following config.xml file
<access origin="*" /> <allow-navigation href="*" />
and using following plugins:
c:\projects\tavlaapp>cordova plugin com.microsoft.azure-mobile-services 1.2.7 "windows azure mobile services" cordova-plugin-whitelist 1.0.1-dev "whitelist" nl.x-services.plugins.calendar 4.3.4 "calendar" nl.x-services.plugins.insomnia 4.0.1 "insomnia (prevent screen sleep)" org.apache.cordova.inappbrowser 0.6.0 "inappbrowser"
any idea's try?
wildcards accepted, scheme, port, or in leftmost position of hostname:
*://*.example.com:*
...this match subdomains of example.com (but not example.com itself), using scheme, on port.
the key here, you, might part in bold above.
you're specifying:
localhost:1337 *.ajax.aspnetcdn.com
but yet calling
http://ajax.aspnetcdn.com http://localhost:1337
maybe change
<meta http-equiv="content-security-policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' *.azure-mobile.net http://localhost:1337 http://ajax.aspnetcdn.com">
i'm specifying port, replace "http" *
hopefully helps, or leads in right direction.
Comments
Post a Comment