ac360
ac360

Reputation: 7835

Production Node Application Can't Find SVG Files

In my local development application the svg files show up just fine with the following code (The curly brackets embed Angular.js variables):

<img ng-src="img/servant_{{servant.personality}}.svg" draggable="false">

But when deployed on Heroku, the SVG files result in a 404:

Failed to load resource: the server responded with a status of 404 (Not Found)

The Angular variable is working on the Production site and the image addresses are accurate. So, that's not the problem.

Instead, I think my Node/Express application might not be able to serve SVG files. Perhaps it's a Heroku issue? FYI I'm using the MEAN stack.

Here is the configuration of my public folder:

 //Setting the fav icon and static folder
        app.use(express.static(config.root + '/public'));

The images are in

public/img

Any thoughts?

Upvotes: 1

Views: 1299

Answers (1)

duncanhall
duncanhall

Reputation: 11431

Ensure you have the correct mime-type configured to serve SVG files. Some servers simply respond with a 404 if the mime for the requested file type is not set.

image/svg+xml

Upvotes: 1

Related Questions