Caddy rewrite request redirects to reverse_proxy upstream

I see you’re using the broken 2.2.2 release; please run sudo apt install caddy=2.2.1. See the below post for the reason:

For your rewrite, it’s easier to write in Caddyfile, then use caddy adapt to see what the underlying JSON looks like. What you’re looking for is this:

rewrite * /image/v2/thumbnail{uri}

You don’t need to do a find and replace, you can just rewrite to add the suffix and append the existing uri.