'Dynamically map url suffix to port number

I am using mountebank to mock a number of REST APIs, each one is accessible through a random port. Users are able to create new mocks or remove old ones whenever they need to.

So I want to setup an apache server such that it maps the suffix of the server url to the associated port, for example: myserver.com/8000 gets automatically proxied to myserver.com:8000

I could regenerate apache config while adding a new reverse proxy, but I would need to restart the server each time and I don't think that's a good idea.

I tried using mod_proxy_express which dynamically generate a proxy map but it seems to only map servers names and not individual paths.

Is this technically possible in apache, or any other web server for that matter ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source