Is it possible to use nginx to select a server by hash from a part of the URL. For example, I have requests of the form http: // host / room / 123456 / invite , http: // host / room / 123456 / user? Id = 2 ... I want all requests with the same room number to come to one same server, because these rooms are keshurutsya on it.
With the current configuration, server selection depends on the entire URL:
upstream backend { hash $uri; server 127.0.0.1:2001; server 127.0.0.1:2002; } So far, I see only the option with modifying the upstream_hash module.