REST Absolute URLs is a tiny module which replaces relative file / image URLs with absolute URLs in the content fields when they are exposed to any Headless D8 successor (like JSON API or any other).
Usage Example
Imagine you've got a textarea field with WYSIWYG. You upload an image through WYSIWYG and it works great: you can see this image when you check this node in Drupal. However, when this node is getting fetched and displayed by any Frontend Framework (like React.js, Angular, etc), then this image is not visible. That's because the image's URL is relative, and can't be found on a server with your Frontend Framework.
This module automatically replaces such relative internal URLs with absolute URLs, so they point to the right server with Drupal where the files are really located.
Known issues
There's a known issue with the domain name when using Docker and server side rendering with node.js. The problem is that Drupal tries to determine the domain name automatically, and when node.js server makes HTTP request to Drupal using the container name instead of real URL (something like http://nginx/), then Drupal will use the container name as a base URL instead of real URL. The solution for this is to set the base URL explicitly:
$config['rest_absolute_urls']['base_url'] = 'https://example.com';
Project information
195 sites report using this module
- Created by spleshka on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.


