Richard West
Richard West

Reputation: 2226

SECURITY_DENIED_BY_MIMEMAP error when serving WOFF font from Azure

I've got a test Wordpress site running in Azure as an Azure Website using the Wordpress install from the Azure gallery.

The site is functional and appears to be working as expected. With one exception. I'm using a custom webfont - http://fortawesome.github.io/Font-Awesome/.

This font has an OTF, SVG, TTF, EOT and WOFF version. From what I understand different devices/browsers use different versions of the file to render to the font.

I'm having a problem serving the .woff version of the file.

I have turning on the logging within the Azure portal and I can see the following error

SECURITY_DENIED_BY_MIMEMAP

FileName C:\DWASFILES\SITES\WWW-MYWPTESTSITE\VIRTUALDIRECTORY0\SITE\WWWROOT\WP-CONTENT\THEMES\AVADA\AVADA\FONTS\FONTAWESOME-WEBFONT.WOFF

I have confirmed that the .woff file exists on the server by logging into via SFTP and browsing to the folder.

I have seen other posts online about adding this information to the web.config file. Something like:

<?xml version="1.0"?>
<!-- Web.Config Configuration File -->
<configuration>
        <system.webServer>
            <modules runAllManagedModulesForAllRequests="true"/>
            <staticContent>
              <remove fileExtension=".svg" />
              <remove fileExtension=".eot" />
              <remove fileExtension=".woff" />
              <mimeMap fileExtension=".svg" mimeType="image/svg+xml"  />
              <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
              <mimeMap fileExtension=".woff" mimeType="application/x-woff" />
            </staticContent>
        </system.webServer>
</configuration>

However, I'm not sure how this can, or should, be added to the Azure hosted site.

UPDATE: Save the above code as web.config and upload to the wwwroot folder. Azure will now allow the .woff font to be downloaded when requested.

Upvotes: 2

Views: 4454

Answers (1)

Richard West
Richard West

Reputation: 2226

Save the following as web.config. Upload the web.config file to the wwwroot folder of the site hosted in Azure. The .woff files will now be served.

<?xml version="1.0"?>
<!-- Web.Config Configuration File -->
<configuration>
        <system.webServer>
            <modules runAllManagedModulesForAllRequests="true"/>
            <staticContent>
              <remove fileExtension=".svg" />
              <remove fileExtension=".eot" />
              <remove fileExtension=".woff" />
              <mimeMap fileExtension=".svg" mimeType="image/svg+xml"  />
              <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
              <mimeMap fileExtension=".woff" mimeType="application/x-woff" />
            </staticContent>
        </system.webServer>
</configuration>

Upvotes: 7

Related Questions