Class NoProxyRules

java.lang.Object
org.microproxy.NoProxyRules

public final class NoProxyRules extends Object
Hosts that bypass the upstream proxy, in the comma-separated NO_PROXY syntax used by curl and most HTTP clients:
  • * matches every host;
  • example.com, .example.com and *.example.com match the domain and all its subdomains;
  • an IP literal matches that address, and CIDR notation (10.0.0.0/8, fd00::/8) matches a range; addresses are compared only when the request names an IP literal (no DNS lookups);
  • any entry may end in :port to apply to that port only.
  • Method Details

    • none

      public static NoProxyRules none()
      Returns rules that never bypass the upstream proxy.
      Returns:
      rules that never match a destination
    • parse

      public static NoProxyRules parse(String list)
      Parses a comma-separated NO_PROXY rule list.
      Parameters:
      list - the comma-separated NO_PROXY rule list
      Returns:
      the parsed bypass rules
    • isEmpty

      public boolean isEmpty()
      Reports whether there are no bypass rules.
      Returns:
      whether there are no bypass rules
    • matches

      public boolean matches(String host, int port)
      Whether requests to host:port should bypass the proxy.
      Parameters:
      host - the destination host name
      port - the destination port
      Returns:
      whether requests to host:port should bypass the proxy