Savvkin
Savvkin

Reputation: 131

How to specify mime type for ServiceStack AllowFileExtensions entry?

To to serve static content, like svg files, I've added extensions like this:

endpointHostConfig.AllowFileExtensions.Add("svg");

But ServiceStack ignores IIS mime type and usess own wrong mime type "application/svg". How to specify correct mime type, for example "image/svg+xml" for svg extension?

Upvotes: 1

Views: 621

Answers (1)

mythz
mythz

Reputation: 143339

You can add your own custom mime-types by adding it to:

MimeTypes.ExtensionMimeTypes["svg"] = "image/svg+xml"; 

I've also just added the SVG mime-type to the default list of AllowedFileExtensions so this will be allowed by default in the next release of ServiceStack v3.9.44+.

Upvotes: 1

Related Questions