Subpath reverse proxy?

Say i have a running nextcloud on the domain “example.com”

And on the same server with nextcloud installed i have something running on localhost port 3000

And i want to be able to type “example.com/subpath”, and it would redirect me to the thing running on localhost 3000

Ofcourse, typing “example.com” would still redirect me to nextcloud. And this would work publicly, aka i wouldnt have to be logged into the server pc for this to work

The things i tried with apache proxypass and proxypassreverse dont work, it just redirects to nextcloud even if i type “example.com/subpath”

Am i trying something that isnt even possible? Still relatively new to this and reverse proxies and apache/nginx configs often feel confusing to my mind