Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Heroku Vue js内容安全策略_Heroku_Vue.js_Content Security Policy - Fatal编程技术网

Heroku Vue js内容安全策略

Heroku Vue js内容安全策略,heroku,vue.js,content-security-policy,Heroku,Vue.js,Content Security Policy,我正在尝试将我的vuejs应用程序上载到heroku,但它不是wprking,所以我使用了教程。我将下面的标记添加到index.html的头部 <meta http-equiv="Content-Security-Policy" content="default-src 'self' http://localhost:5000 'unsafe-inline' 'unsafe-eval'; script-src 'self' http://localhost:5000 'unsafe-inl

我正在尝试将我的vuejs应用程序上载到heroku,但它不是wprking,所以我使用了教程。我将下面的标记添加到index.html的头部

<meta http-equiv="Content-Security-Policy" content="default-src 'self' http://localhost:5000 'unsafe-inline' 'unsafe-eval'; script-src 'self' http://localhost:5000 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline' 'unsafe-eval'; media-src *">

但它仍然不起作用。我在控制台中发现以下错误:

拒绝加载图像的数据:image/svg+xml;base64,_IMAGE_DATA',因为它违反了以下内容安全策略指令:“default src‘self’”。请注意,“img src”未显式设置,因此“default src”用作回退

我如何解决这个问题? 我已经检查了有关堆栈溢出的其他cordova相关答案,但它们似乎都不适合我。

让我们试试这种方法

您是否在网页包中使用了url加载程序

如果答案为“是”,则在删除如下代码时,它将起作用:

module: {
    rules: [
        {// remove the block
            test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
            loader: 'url-loader',
            options: {
                limit: 10000,
                name: utils.assetsPath('img/[name].[hash:7].[ext]')
            }
        },
    ]
}

使用文件加载器替换url加载器时,不会引用图像使用base64。

我没有使用url加载器。我是vue js的新手