Open jamesmunns opened 1 month ago
Expanding on these thoughts and trying to clarify what we might want:
Right now, a service has these properties:
From a first glance, it seems like we would like to have a "multiservice" instance with the following qualities:
There are two main phases where we could make this decision:
request_filter
stage - this is the first hook in the systemupstream_peer
stage - this is currently where upstreams are selectedI'm inclined to focus on the request_filter
stage:
pandora-web-server
only acts in this phase, and serves the entire connectionImplementation wise, I believe this would require definining a new kind of service that would contain a unified set of rules (maybe just domain + URI?) to select which "subservice" matches, and continue using that.
This probably requires some kind of dyn trait that describes subservices, and delegates to that. This will likely then require storing the subservice handle in the CTX field, and using that to dispatch any later requests appropriately.
A common use case for reverse proxies is to accept multiple "groups" of incoming connections.
This could be:
Service
that serves multiple apex domains, but proxies to different subsets of listeners:example.com
andelpmaxe.com
Service
that routes a single apex domain, but proxies different kinds of requests to different subsets of Listeners:example.com/v1/*
goes to one set of upstreams, whileexample.com/v2/*
goes to another set of upstreamsexample.com/**/*.pdf
goes to one set of upstreams, whileexample.com/**/*.html
goes to another set of upstreamsexample.com/static/*
should be served directly byriver
example.com/*
should be proxied to the listnersThis arises as we may want to have something that feels like multiple services, but all served through a single set of
:443
or:80
ports.The current BasicProxy (nor static file service) is not flexible enough to handle these cases - we have a single set of "downstreams", and a single set of "upstreams" - with no way to multiplex between the two.
For example, NGINX allows multiple servers to listen to a single listening port. From this article:
Note that BOTH servers are listening to port 443, but each have their own upstreams (server02 and server01, with different ports).