网站在localhost上工作得很好,但在生产环境中显示内容安全策略错误

时间:2018-04-04 18:33:46

标签: reactjs content-security-policy

控制台上显示

错误:

  

199483d564c61b347c.js:格式化:11拒绝应用内联样式   因为它违反了以下内容安全策略指令:   “default-src'self'”。一个'unsafe-inline'关键字,一个哈希   ('sha256-mc5MFFuny ++ HbPmYE2clhmGeDbhhMCQG815PTPVKnzs =​​'),或者一个随机数   ('nonce -...')是启用内联执行所必需的。另请注意   'style-src'没有明确设置,因此'default-src'用作a   回退。

登陆组件

import React,{Component} from 'react';

class Landing extends Component{
    render(){
        return (
            <div>
                <div className="para1"></div>
                <div className="section white">
                    <div className="row container">
                    <h2 className="header">Goonj</h2>
                    <p className="grey-text text-darken-3 lighten-3">Coonect with ngo's</p>
                    </div>
                </div>

                <div className="para2"></div>

            </div>
        )
    }

}

export default Landing;

landing.css

.para1 {
    background-image: url(../images/goonj1.jpg);
    min-height: 500px; 
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: auto;
}

.para2 {
    background-image: url(../images/goonj2.jpg);
    min-height: 500px; 
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: auto;
}

如何在不违反内容安全政策的情况下解决问题???

0 个答案:

没有答案