Class RouterIpResolverInterceptor

java.lang.Object
com.predic8.membrane.core.sslinterceptor.RouterIpResolverInterceptor
All Implemented Interfaces:
SSLInterceptor

public class RouterIpResolverInterceptor extends Object implements SSLInterceptor
Checks, whether the exchange's remoteIp is one of the routers. If yes, sends a POST to https://$router:$port/ with a body of {"port":$remotePort, "ip":$remoteIp}, expecting an HTTP 200 application/json {"ip":$realIp} in return. If successful, replaces the exchange's remoteIp with the retrieved IP address.

This interceptor is helpful in scenarios with multiple redundant routers for inbound HTTP requests.

  • Constructor Details

    • RouterIpResolverInterceptor

      public RouterIpResolverInterceptor()
  • Method Details

    • getRouterIps

      public String getRouterIps()
    • setRouterIps

      public void setRouterIps(String routerIps)
    • getHttpClientConfiguration

      public HttpClientConfiguration getHttpClientConfiguration()
    • getPort

      public int getPort()
    • setPort

      public void setPort(int port)
      Default
      If not set (=0), the default port of the connection protocol (https) is used.
    • getErrorOutcome

      public Outcome getErrorOutcome()
    • setErrorOutcome

      public void setErrorOutcome(Outcome errorOutcome)
      Default
      ABORT
    • setHttpClientConfiguration

      public void setHttpClientConfiguration(HttpClientConfiguration httpClientConfiguration)
    • getSslParser

      public SSLParser getSslParser()
    • setSslParser

      public void setSslParser(SSLParser sslParser)
    • init

      public void init(Router router) throws Exception
      Specified by:
      init in interface SSLInterceptor
      Throws:
      Exception
    • handleRequest

      public Outcome handleRequest(SSLExchange exc) throws Exception
      Specified by:
      handleRequest in interface SSLInterceptor
      Throws:
      Exception