Enum Class ProxyProtocolMode

java.lang.Object
java.lang.Enum<ProxyProtocolMode>
org.microproxy.ProxyProtocolMode
All Implemented Interfaces:
Serializable, Comparable<ProxyProtocolMode>, Constable

public enum ProxyProtocolMode extends Enum<ProxyProtocolMode>
Whether client connections start with a PROXY protocol header (v1 or v2, as HAProxy defines them), which names the client a load balancer in front of the proxy connected for. See HttpProxyServerBootstrap.withAcceptProxyProtocol(ProxyProtocolMode).
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    No PROXY header is read: the connection's first bytes are the client's.
    A connection may start with a PROXY header: one that starts with a v1 ("PROXY ") or v2 signature has it read, and any other is served as if PROXY protocol were off, its first bytes left as they came.
    Every connection must start with a PROXY header; one that does not is closed.
  • Method Summary

    Modifier and Type
    Method
    Description
    parse(String value)
    The mode a configuration value names: off, required or optional (any case), or a boolean as LittleProxy's allow_proxy_protocol key takes it ( true, on or 1 for REQUIRED; false, off, 0, no or nothing for OFF).
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • OFF

      public static final ProxyProtocolMode OFF
      No PROXY header is read: the connection's first bytes are the client's. The default.
    • REQUIRED

      public static final ProxyProtocolMode REQUIRED
      Every connection must start with a PROXY header; one that does not is closed. Use it when every client reaches the proxy through a load balancer that sends the header.
    • OPTIONAL

      public static final ProxyProtocolMode OPTIONAL
      A connection may start with a PROXY header: one that starts with a v1 ("PROXY ") or v2 signature has it read, and any other is served as if PROXY protocol were off, its first bytes left as they came. Any client that can reach the listener can then claim any source address by sending a header, so use it only where the clients that can connect directly are trusted, or with HttpProxyServerBootstrap.withProxyProtocolTrustedSources(java.lang.String...) naming the load balancers whose headers count.
  • Method Details

    • values

      public static ProxyProtocolMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ProxyProtocolMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • parse

      public static ProxyProtocolMode parse(String value)
      The mode a configuration value names: off, required or optional (any case), or a boolean as LittleProxy's allow_proxy_protocol key takes it ( true, on or 1 for REQUIRED; false, off, 0, no or nothing for OFF).
      Parameters:
      value - the configuration value
      Returns:
      the mode it names
      Throws:
      IllegalArgumentException - for any other value