Search code examples
delphiproxyindy

Indy's TIdHTTPProxyServer: all traffic should run over a specific IP


Suppose I have a server with multiple IP addresses. Is it possible to use a specific IP for external requests (something like BoundIP of TIdHTTP) ?


Solution

  • If you want inbound traffic to come from specific network adapter(s), use the TIdHTTPProxyServer.Bindings property to setup your desired listening port(s) for those adapter(s) before activating the server.

    If you want outbound traffic to be sent out from a specific network adapter, then inside the TIdHTTPProxyServer.OnHTTPBeforeCommand event, you can type-cast the AContext.OutboundClient property to TIdTCPClient and then set its BoundIP property.