Configure URL rewriting
To ensure that relative links in HTML are rendered properly when integrating a rendering host with advanced Sitecore editors, Headless Services rewrites relative URLs in the returned markup to be absolute. The default tags and attributes included in this processing are as follows:
| Tag name | Attribute name |
|---|---|
audio | src |
img | src, srcset |
link | href |
script | src |
source | src, srcset |
track | src |
video | poster, src |
Disable URL Rewriting
If you do not want Headless Services to rewrite relative URLs in the returned markup into absolute URLs, you can disable URL rewriting.
To disable URL rewriting:
-
In your app configuration, for the configured
httprender engine instance, change the value of the optionEnableRelativeLinkProcessingtofalse:
Configure rewritten HTML attributes
You can customize URL rewrites by modifying the configuration for the rendering engine instance.
To configure rewritten HTML attributes:
-
In your app configuration, for your configured
httprendering engine instance, in aLinkReplacementelement, specify the attributes used for link replacement usingLinkMapelements. For example:
Add a path to ignored paths
Some relative URL paths must not be rewritten by Headless Services. By default, these are:
-/media/~/media/-/jssmedia/~/jssmedia/
To add a URL path to the ignored paths:
-
In your app configuration, for your configured
httprendering engine instance, specify the ignored paths in anIgnoredPathselement usingPathelements. For example: