0

Our application (http://www.example.org/) allows contributor users to create HTML content and upload assets (using TinyMCE editor and an asset uploader component), which are then stored in our database (for the HTML content) and an assets server (http://static.example.org/). The HTML is then rendered to reader users by inserting it "as-is" dynamically into a page.

We would like to maintain our pre-production environment (http://www-pp.example.org/) as close to the production as possible, by periodically importing the production database and assets (http://static-pp.example.org/).

The problem with this setup is that the asset URLs contained in the replicated database point to our production assets server instead of the pre-production.

Is there a way to solve this problem other than running a script to update all asset URLs when restoring the production backup? For example, we would like to be able to store relative URLs in our database, and dynamically set a base URL for all of the assets (we can't use the <base> HTML tag because this base URL logic does not apply to all relative URLs in the page displayed to the users).

Maxime Rossini
  • 3,612
  • 4
  • 31
  • 47
  • Wouldn't it be a solution if you'd prepend assets domain to asset URLs when outputting HTML instead of outputting as-is? – Zoli Szabó Oct 07 '17 at 15:14
  • That would work, but it involves parsing the HTML using a regex-like tool, and can be error-prone. I was wondering if something more "standard" existed, like the `` HTML5 tag, but for a specific HTML section. Maybe we could output the HTML in an iframe and use this tag, but that's a bit frustrating and could cause other issues. – Maxime Rossini Oct 07 '17 at 16:11

0 Answers0