How to return absolute path?

  1. Add to .env:
WEBSITE=http://mywebsite.com
  1. Add the recently added env to /config/server.js
module.exports = ({ env }) => ({
  host: env('HOST', '127.0.0.1'),
  port: env.int('PORT', 1337),
  url: env('WEBSITE', 'http://127.0.0.1'), // THIS ONE
});
  1. Modify your controller like this:
const { sanitizeEntity } = require('strapi-utils');
module.exports = {
  async findOne(ctx) {
    const { id } = ctx.params;
    const entity = await strapi.services.blogs.findOne({ id });
    entity.Content = entity.Content.replace('src="/', `src=\\"${strapi.config.get('server.url')}/`); // Here we modify the 'Content' and add your website "url" to it
    return sanitizeEntity(entity, { model: strapi.models.blogs });
  },
};

Profit.

2 Likes