• Document Up to Date
  • Updated On 4.0.3

Remote Assets

Remote assets are binary files, typically images, videos, pdf documents, etc. which are hosted outside of CrafterCMS. Remote assets could be hosted in AWS S3 or compatible storage, Box or some other server accessed through WebDAV, etc.

Various data sources are available to help manage/select assets hosted outside of CrafterCMS in your site. The Developer section contains some examples on how to store assets remotely, such as Use S3 to store assets and Use Box to store assets. The Site Administrators section contains information on how to configure CrafterCMS to access services used for storing assets remotely here: Studio Configuration.

Browser access to remote assets on your site is provided by Crafter Engine’s remote assets controller via the URL pattern /remote-assets/STORE-TYPE/PROFILE-ID/PATH-TO-ASSET, where:

  • STORE-TYPE the remote repository storage used, for our example above, S3

  • PROFILE-ID ID used to refer to remote repository profile

  • PATH-TO-ASSET path to asset in the remote repository

Disabling /remote-assets Access

Sometimes you may want to disable access to remote repositories. To do this, in your authoring or delivery install, open the file rendering-context.xml under apache-tomcat/shared/classes/crafter/engine/extension/ and edit the file to define a set of crafter.urlMappings without the remote-asset controller, like this:

{CRAFTER-INSTALL}/bin/apache-tomcat/shared/classes/crafter/engine/extension/rendering-context.xml
1<util:map id="crafter.urlMappings">
2    <entry key="/api/**" value-ref="crafter.restScriptsController"/>
3    <entry key="/api/1/services/**" value-ref="crafter.restScriptsController"/> <!-- Deprecated mapping, might be removed in a later version -->
4    <entry key="/static-assets/**" value-ref="crafter.staticAssetsRequestHandler"/>
5    <!--entry key="/remote-assets/**" value-ref="crafter.remoteAssetsRequestHandler"/-->
6    <entry key="/*" value-ref="crafter.pageRenderController"/>
7</util:map>

Note

Please take note that if you disable /remote-access in your authoring install, preview of remote assets will be broken.

By-passing /remote-assets in Delivery for WebDAV

To avoid proxying the WebDav /remote-assets in Delivery, the Delivery Deployer target should be configured to have a find and replace processor that changes the /remote-assets URL to an actual Apache static asset delivery URL.

{CRAFTER-DELIVERY-INSTALL}/data/deployer/targets/SITE-NAME-default.yaml
1- processorName: findAndReplaceProcessor
2  textPattern: /remote-assets/webdav(/([^&quot;&lt;]+)
3  replacement: 'http://apache.static-asset.delivery.url$1'