Reverse_proxy to path

Caddy version: 2.3.0-2.fc35

Hi, I’m trying to reverse_proxy example.website.com to website.com/example/ but I can’t manage to get it working.

https://*.website.com {
    reverse_proxy localhost:3000/{http.request.host.labels.2}/
}

This isn’t working. When I try it with this way, I get HTTP ERROR 502
So far, reverse_proxy localhost:3000 works but It’s not working with path.

Is there a way to achieve the solution?

Thank you.

I answered with a followup on this other topic: