Copied to clipboard

Flag this post as spam?

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

  • Paul Silver 2 posts 72 karma points
    Sep 03, 2019 @ 21:18
    Paul Silver

    Umbraco 8 using a separate static content site for media or a CDN for static files

    In Umbraco 7, you could configure your Filesystem provider with a url and a physical file location (e.g. a UNC path) to simply store your files on a UNC share and have them served through a totally different hostname / url - e.g.

    I am struggling in Umbraco 8 to achieve the same results since this no longer works this way.

    I tried implementing a custom IFileSystem provider and wired it up using composers. I am able to upload files properly to my unc path with it, and they are displayed if you use the content item on a page.

    However, the media picker in the back office does not work at all - it seems like since I am returning the absolute URL to the image in my provider's GetUrl method, the path field of [umbracoMediaVersion] table is null. When using the default PhysicalFileSystem provider, this field gets a relative path stored there and the back office works fine.

    There were no working examples so I used the PhysicalFileSystem provider from umbraco 7's source code as a starting point.

    So two questions:

    1. Is it even possible to make this work with a custom filesystem provider so that it works like it did in version 7 or are there just hard coded assumptions now that this will break by having an absolute url pointing somewhere
    2. If I can't override the filesystem provider, is there some way when the content is rendered that I can change the URL? The content can be replicated from our content editing host system to the UNC file location of the static content site and then on render if I can change the url from a local path to the absolute url pointing to the content site then that would solve my problem as well. Not sure what extension point if any I could even use for that - maybe intercept / hijack the IContentItem that gets returned when querying for media?

    The Azure blob provider is the only example out there now for custom filesystems that I am aware of and that doesn't work the way I would need it to (we aren't using Azure anyways).

    Any suggestions on extension points to solve #2 or any ideas on how to get Umbraco 8 to do what version 7 did on #1 would be greatly appreciated.

Please Sign in or register to post replies

Write your reply to: