Combining rewrite and reverse_proxy

Your backend application will need to be configured to run in a subfolder:

Or you can perform replacements in response bodies (somewhat finicky). That linked wiki has more details.

(This is not a Caddy-specific problem; just something that affects all apps that are reverse-proxied. Many apps are poorly-designed.)