CSP - Refused to load the image

Micheale See 1 Reputation point
2021-10-21T03:22:04.27+00:00

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

Internet Information Services
0 comments No comments
{count} votes