sony / nmos-cpp

An NMOS (Networked Media Open Specifications) Registry and Node in C++ (IS-04, IS-05)
Apache License 2.0
136 stars 80 forks source link

Use a reverse-proxy with nmos-cpp-node #391

Open joaofigueiredobisect opened 1 month ago

joaofigueiredobisect commented 1 month ago

Hello,

I have a question.

My goal is to use a reverse proxy and send the reverse proxy IP (for example, 192.168.1.2) to the registry. When accessing this address, the reverse proxy should redirect to the IP where the node is running (for example, 192.168.1.1).

My question is: Is it possible to have a node running on one IP (like 192.168.1.1) but send a different IP (like 192.168.1.2) to the registry?

garethsb commented 1 month ago

With your own Node based on nmos-cpp, the thing to do is to set host_address(es) to the address(es) of the reverse proxy and use proxy_map to map between reverse proxy port(s) and the port(s) where the Node is actually running.

Of course, as well as the addresses/ports on which the NMOS APIs are being served, there's also the ones that Senders and Receivers are using. Both their IP addresses (in IS-05) and their interfaces (in IS-04) are advertised via NMOS. The example nmos-cpp-node doesn't really send or receive media streams, but it uses the first and last host_address(es) for its mock Senders and Receivers and attempts to discover the local interfaces associated with those IP addresses, which won't necessarily work with a reverse proxy IP address. I think it's possible to set up a working example nmos-cpp-node config with a reverse proxy but it needs a bit of care.

Also consider that we should be encouraging people to use DNS names instead of IP addresses. Therefore we also need to think about using host_name and href_mode.

And then there's security: client_secure and server_secure can be used along with the above to allow deployment of nmos-cpp behind a reverse proxy that does TLS termination. (That was one of the original motivations.)