Class ApacheProxyAddressStrategy

  • All Implemented Interfaces:
    IServerAddressStrategy

    public class ApacheProxyAddressStrategy
    extends IncomingRequestAddressStrategy
    Works like the normal IncomingRequestAddressStrategy unless there's an x-forwarded-host present, in which case that's used in place of the server's address.

    If the Apache Http Server mod_proxy isn't configured to supply x-forwarded-proto, the factory method that you use to create the address strategy will determine the default. Note that mod_proxy doesn't set this by default, but it can be configured via RequestHeader set X-Forwarded-Proto http (or https)

    List of supported forward headers:

    • x-forwarded-host - original host requested by the client throw proxy server
    • x-forwarded-proto - original protocol (http, https) requested by the client
    • x-forwarded-port - original port request by the client, assume default port if not defined
    • x-forwarded-prefix - original server prefix / context path requested by the client

    If you want to set the protocol based on something other than the constructor argument, you should be able to do so by overriding protocol.

    Note that while this strategy was designed to work with Apache Http Server, and has been tested against it, it should work with any proxy server that sets x-forwarded-host