Fernando Fabreti
Fernando Fabreti

Reputation: 4366

content security policy error, but meta-tag includes URL

Why am I receiving errors like this?

Refused to load the script 'http://maps.googleapis.com/maps/api/js?v=3&sensor=false'


because it violates the following Content Security Policy directive: 
"script-src 'self' *.googleapis.com 'unsafe-inline' 'unsafe-eval'".

my meta-tag:

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

Upvotes: 0

Views: 1485

Answers (1)

Fernando Fabreti
Fernando Fabreti

Reputation: 4366

Seems like I needed explicit URI-scheme. This work:

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

Upvotes: 5

Related Questions