How do we implement a dynamic HTTP reverse proxy in nginx where it accept incoming requests from clients and rewrite/proxy them to dynamic upstreams as instructed by a "dynamic routing endpoint"
the dynamic routing endpoint is an external HTTP API endpoint that returns the IP:port of the upstream for each request
when nginx receives a request it should send an HTTP subrequest, containing only the HTTP method, target hostname and URL of the original request, to the dynamic
routing HTTP endpoint
the dynamic routing HTTP endpoint responds to each request with a list of IP:port tuples Nginx should pick a random IP:port tuple from the ones returned in the subrequest as the upstream and proxy_pass the original request to it