Is it possible to use apache to proxy a hostname and port dynamically like so:
/<PORT>/<HOSTNAME> -> http://<HOSTNAME>.domain.local:<PORT>
ProxyPassMatch "^/([0-9]+)/(host-[0-9]+)$" "http://$2.domain.local:$1"
From Apache Docs:
The URL argument must be parsable as a URL before regexp substitutions (as well as after). This limits the matches you can use.
RewriteEngine On RewriteRule "^/([0-9]+)/(host-[0-9]+)$" "http://$2.domain.local:$1" [P]
(But this comes with performance penalty, and also keep in mind that with such dynamic proxying you can not use ProxyPassReverse to adjust the URL in HTTP redirect responses)