question

MichealeSee-0444 avatar image
0 Votes"
MichealeSee-0444 asked YijingSun-MSFT edited

CSP - Refused to load the image

Hi All,

I have web.config as below:-

<httpProtocol>
<customHeaders>
<!-- Hide Server Information -->
<remove name="X-Powered-By" />
<remove name="X-AspNetMvc-Version" />
<add name="Content-Security-Policy" value="default-src 'none';
script-src 'self' 'unsafe-inline' 'unsafe-eval';
connect-src 'self' 'unsafe-inline';
img-src https://xxx.corporation.com 'self' 'unsafe-inline';
style-src 'self' 'unsafe-inline';
style-src-elem 'self' 'unsafe-inline';
font-src 'self';
frame-src 'self';
frame-ancestors 'none';
block-all-mixed-content;" />
<!-- Referrer Policy -->
<add name="Referrer-Policy" value="No-referrer-when-downgrade" />
<!-- Anti-Clickjacking-->
<add name="X-Frame-Options" value="DENY" />
<!-- Anti-XSS for IE -->
<add name="X-Xss-Protection" value="1; mode=block" />
<!-- HSTS -->
<add name="Strict-Transport-Security" value="max-age=31536000; includeSubDomains" />

I got error:-
Refused to load the image 'https://xxx.corporation.com/SitePages/Images/logos.gif' because it violates the following Content Security Policy directive: "default-src 'none'". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback.

Please advise.

Thanks.

Regards,
Micheale

windows-server-iis
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers