0

I need to make a mirrored website with a slightly different info.
spawning up a new server for each site is too much work, and takes a lot of effort to update.
most of the content should be intact, but only some files should be tweaked a little, like language files, and some images.

I was thinking that this can be done easily with a proxy server like Squid, that also has a cache. but I could not find how to alter these certain files.

so for example: main site is www.site1.com:

www.site1.com    --- PROXY -->    spa.site1.com (altered images and lang)
www.site1.com    --- PROXY -->    fra.site1.com (altered images and lang)

What's the best approach to this, or maybe I should use an apache server with mod_proxy and mod_substitute?

Thanks

Ted
  • 111
  • 3
  • HAProxy does not seem to be able to control any content at all – Ted Aug 20 '20 at 23:17
  • I confess I may be a disciple of yours, but I bumped into this on line 73: https://www.bookstack.cn/read/HAProxy-2.0-StarterGuide/spilt.1.spilt.4.ae344a58822000a3.md – Ted Aug 21 '20 at 00:36
  • Note, that I am trying to change words, not URLS – Ted Aug 21 '20 at 00:37
  • 1
    You should have different files that contain the altered words. Modifying the document content on the fly will increase the load on the web server and harm caching. To generate on the fly, use a language like PHP and do a string replace (or pull from a database or whatever). But if the text is static it is better to build the different versions from a template. – tater Aug 21 '20 at 00:41

1 Answers1

0

Example method, one of many possible approaches.

<VirtualHost *:80>
  ServerName example.com
  DocumentRoot /var/www/html
  Alias "/lang" "/var/www/en"
</VirtualHost>
<VirtualHost *:80>
  ServerName es.example.com
  DocumentRoot /var/www/html
  Alias "/lang" "/var/www/es"
</VirtualHost>
<VirtualHost *:80>
  ServerName fr.example.com
  DocumentRoot /var/www/html
  Alias "/lang" "/var/www/fr"
</VirtualHost>

If you cannot consolidate all the variant-specific files into one(few) directory(ies), then consider rewriting the URLs with RewriteCond / RewriteRule.

Or use HAProxy, http-request replace-path <whatever> if <condition>, where one condition can be -f <lookupfile> where lookupfile is a list of URLs to replace.

tater
  • 1,445
  • 2
  • 10
  • 12