I'm looking for a reverse TCP proxy (or similar) that is capable of starting and stopping the proxied application as needed.
Something like this:
- The proxy listens on a specified port (nothing special here), but the application is not running.
- If a client connects to the port, the proxy accepts the connection and starts the application (unless it is already running).
- Once the application is started, the proxy passes the request to the application and serves its response (usual proxy behavior).
- If the (last) client disconnects, the proxy stops the application (possibly after some delay in case of a promptly reconnect).
Reason for this is that the application is very resource intensive and it is only accessed occasionally.
The proxy should therefore be lightweight. My server runs CentOS.