Reverse proxy with html rewrite

I have several web servers I would like to place being a Caddy server. This is because I want to have authentication and encryption (https) from the entry point.
The problem is that some of the web servers, e.g. the godoc web server, expects to be accessed as a root url on its host. E.g., in the returned html, is a reference to url ‘/lib/…’

I know I can either start using different hosts (e.g.,, or to rewrite all root URLs used by the backend web server (e.g. ‘/lib’ to godoc server, ‘/css’ to gollum server, etc), but I don’t like those solutions.

Is there a way to do similar to Apache’s mod_proxy_html, ref mod_proxy_html - Apache HTTP Server Version 2.4

It receives the response from the backend web server and rewrites all its URLs using URLs available externally.

I am also planning to use Caddy in a setup that has a number of proxy servers. I have this same issue with a site running in the CMS “Magnolia”; sadly, internally Magnolia generates both relative and absolute URLs in different parts (in v3 - this is old, and I haven’t yet seen if v5 is different, but converting would be a big project in any case).

I could run an Apache proxy with mod_proxyHTML between Caddy and Magnolia, but that would be a messy solution, which I would like to think wouldn’t need to be permanent.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.