简体   繁体   中英

Loading image SVG and getting Content Security Policy (CSP) error

I'm trying to load SVG images and get a CSP error as follows:

在此处输入图像描述

I keep getting the error event when I added the meta tag:

<meta http-equiv="Content-Security-Policy" content="default-src *;img-src * 'self' data: https:; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; style-src  'self' 'unsafe-inline' *" >

The error that you can see tells you that the img-src was not set and it fallbacks to default-src even though that you have added meta tag with your CSP values.

This behaviour can be observed when the CSP header is already set via HTTP . You have to choose whether to set it via HTTP or as meta tag.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM