Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul Seal 524 posts 2889 karma points MVP 7x c-trib
    Jun 24, 2019 @ 08:49
    Paul Seal
    1

    SVG media files not loading from Azure Blob Storage

    Hi all

    I have a site which is storing the media files in blob storage. This is working fine for normal images.

    I also have some SVG files in the media section, which are not loading, and in the console I get a 404 for each SVG.

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

    The normal images in the media section load fine, it's just SVGs.

    Strangely, if I delete the Web.config file from the media folder in my solution, it then works, so there must be something about the handlers in this config which is preventing the SVGs from loading.

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <system.webServer>
        <handlers>
          <clear />
          <add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
        </handlers>
      </system.webServer>
    </configuration>
    

    Does anyone know how I can resolve this please, without deleting the web.config file from the media folder?

    Thanks

    Paul

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jun 24, 2019 @ 15:00
    Jeavon Leopold
    104

    Hi Paul,

    For Umbraco v7.5+ you need to add a StaticFileHandler to media/web.config also otherwise the VPP won't work.

    It should look like

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <handlers>
                <clear />
                <add name="StaticFileHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.StaticFileHandler" />
                <add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
            </handlers>
        </system.webServer>
    </configuration>
    

    More information and this config and the VPP can be found at https://github.com/JimBobSquarePants/UmbracoFileSystemProviders.Azure#virtual-path-provider

    Jeavon

  • Jeroen Vantroyen 54 posts 394 karma points c-trib
    Oct 15, 2019 @ 09:48
    Jeroen Vantroyen
    0

    Different problem, same solution. Thanks, Jeavon!

    I investigated in sourcecontrol what happened to the file. It contained the StaticFileHandler, but it was removed when updating packages to Umbraco 8.1.5.

    I would need to reproduce this behaviour to be absolutely certain.

  • Michael Nielsen 82 posts 362 karma points
    May 20, 2020 @ 13:18
    Michael Nielsen
    0

    I have the same issue on Umbraco 8

    I've added the StaticFileHandler to both web.config in root and in media.

    But SVG files aren't loading, regular images are https://prnt.sc/ske2hg

  • Michael Nielsen 82 posts 362 karma points
    May 20, 2020 @ 13:38
    Michael Nielsen
    0

    Another thing that stops working, is cropping images from outside the media library, i.e.:

    /img/test-image.png?mode=crop&width=500&height=300&format=jpg&quality=60
    
  • Simon steed 376 posts 688 karma points
    Jan 31, 2023 @ 09:35
    Simon steed
    0

    Did anyone ever get to the bottom of this? We have this in local and production environments and just cannot get a solution that works?

    Si

Please Sign in or register to post replies

Write your reply to:

Draft