Error loading SVG - ERR_CONTENT_DECODING_FAILED

2.3k views Asked by At

I have a server running Nginx with the Google Pagespeed module installed.

Up until recently, I had no issues with SVGs on my website, however now Chrome is giving me the error: Failed to load resource: net::ERR_CONTENT_DECODING_FAILED

The image is located in: /images/bg.svg

Manually loading the image with a random query parameter ie. bg.svg?v=2 loads the SVG normally without errors so perhaps it's a caching issue.

How can I go about troubleshooting this problem?

1

There are 1 answers

1
Pyry Liukas On

Have a look at the discussion behind this link https://github.com/pagespeed/ngx_pagespeed/issues/1346

Same error is discussed as a ngx_pagespeed issue. Solution that worked for me was adding this to my nginx config:

pagespeed Disallow "*.svg";

More info about it: https://modpagespeed.com/doc/restricting_urls