Class ProxyPeerAddressHandler

  • All Implemented Interfaces:
    HttpHandler

    public class ProxyPeerAddressHandler
    extends java.lang.Object
    implements HttpHandler
    Handler that sets the peer address to the value of the X-Forwarded-For header.

    This should only be used behind a proxy that always sets this header, otherwise it is possible for an attacker to forge their peer address;

    Author:
    Stuart Douglas
    • Constructor Detail

      • ProxyPeerAddressHandler

        public ProxyPeerAddressHandler​(HttpHandler next)
      • ProxyPeerAddressHandler

        public ProxyPeerAddressHandler​(HttpHandler next,
                                       boolean isChangeLocalAddrPort)
    • Method Detail

      • handleRequest

        public void handleRequest​(HttpServerExchange exchange)
                           throws java.lang.Exception
        Description copied from interface: HttpHandler
        Handle the request.
        Specified by:
        handleRequest in interface HttpHandler
        Parameters:
        exchange - the HTTP request/response exchange
        Throws:
        java.lang.Exception
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object