Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ProxySettings

Utility class to provide an http agent to REST APIs that is configured for a proxy server based on commonly used environment variables.

Supports the usage of the environment variables HTTP_PROXY, http_proxy, HTTPS_PROXY, https_proxy. If any of these env variables is set and depending how the Zowe session is configured for http or https it instantiates an appropriate http agent utilizing a popular third party library. If the z/OS system uses self-signed certificates then the proxy server must be configured to accept them. If the proxy server itself is configured with self-signed certificates then the user needs to either import these certificates on their workstation, use rejectUnauthorized in their Zowe profile, or use the (not recommended) nodejs variable NODE_TLS_REJECT_UNAUTHORIZED=0. This class also looks for the environment variables NO_PROXY or no_proxy. These work with a simple comma separated list of hostnames that need to match with the hostname of the Zowe profile.

Hierarchy

  • ProxySettings

Index

Methods

Static Private checkUrl

  • checkUrl(inputUrl: string): URL | undefined

Static Private getHttpEnvVariables

  • getHttpEnvVariables(): string | undefined

Static Private getHttpsEnvVariables

  • getHttpsEnvVariables(): string | undefined

Static Private getNoProxyEnvVariables

  • getNoProxyEnvVariables(): string[] | undefined

Static getProxyAgent

  • getProxyAgent(session: ISession): Agent | undefined
  • Retrieve an appropriate http.agent instance if proxy environment variables can be found.

    static
    memberof

    ProxySettings

    Parameters

    • session: ISession

      Zowe ISession containing the hostname for the http request. Uses the session's rejectUnauthorized also for the proxy connection.

    Returns Agent | undefined

    an instance of an appropriate subclass of node's https.agent if proxy settings were found. Returns undefined if no proxy settings are found.

Static Private getProxySettings

  • getProxySettings(session: ISession): ProxySetting | undefined

Static getSystemProxyUrl

  • getSystemProxyUrl(session: ISession): URL | undefined
  • Returns the URL to the proxy server if proxy environment variables can be found. Can be used for testing the settings and logging connection details.

    static
    memberof

    ProxySettings

    Parameters

    • session: ISession

      Zowe ISession containing the hostname for the http request.

    Returns URL | undefined

    URL to proxy server

Static matchesNoProxySettings

  • matchesNoProxySettings(session: ISession): boolean
  • If the NO_PROXY or no_proxy environment variables are set with a comma separated list of hostnames it will try to match the hostname of the Zowe ISession and return true if found. Performs a simple string compare ignoring casing and white spaces, but will not resolve hostnames to ip addressees and not perform wildcard matching.

    static
    memberof

    ProxySettings

    Parameters

    • session: ISession

      Zowe ISession containing the hostname for the http request.

    Returns boolean

    true if the Zowe session host matches an entry in the comma separated list of hostnames in the environment variable. false otherwise.

Generated using TypeDoc