I have a very special use case - and I'm wondering if there isn't a better solution.
Several users should be able to reach one of about 1000 target instances (C1 to C1000) coming from an Nginx instance (A) at the same time.
Unfortunately, 100 target instances each have to be located behind a separate Nginx instance (B1 to B10) as a reverse proxy.
If several users jump in parallel from their respective client to A and from there then to one of the B Nginx instances and from there then to one of the underlying C target instances, the question arises of how to ensure the session consistency of each individual session. In addition, C target instances must be able to set session cookies on the respective client that comes to this C target instance via the A-Nginx instance, from there the respective B-Nginx instance.
Each user who calls A gets a separate port. The connections between A and the individual B instances run via separate ports, e.g. from A to B1 10000, A to B2 11000, etc., A to B10 20000. The connections from B instances to the C target instances are maintained on dedicated ports as well, e.g. connection B1 to C0001 on port 10001, connection B1 to C0002 on port 10002, etc..
I hate this construct, but it works. The question is - what am I missing. I can't imagine there isn't a more elegant way.
Does anybody has a good idea how to solve the problem with in a more elegant way? Maybe somehow with session cookies?