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

- checkUrl
- getHttpEnvVariables
- getHttpsEnvVariables
- getNoProxyEnvVariables
- getProxyAgent
- getProxyAuthHeader
- getProxySettings
- getSystemProxyUrl
- matchesNoProxySettings

## Methods

### Static Private checkUrl

- checkUrl(inputUrl: string): URL | undefined

- - Defined in @zowe/imperative/src/rest/src/client/ProxySettings.ts:194

  Parses a string to check if it is a valid URL.

  static
  memberof

    Proxy

  #### Parameters

  - ##### inputUrl: string

    a string with a URL

  #### Returns URL | undefined

  a URL instance or undefined if not a valid url.

### Static Private getHttpEnvVariables

- getHttpEnvVariables(): string | undefined

- - Defined in @zowe/imperative/src/rest/src/client/ProxySettings.ts:153

  Parses environment variables valid for http requests.

  static
  memberof

    ProxySettings

  #### Returns string | undefined

  `string` if valid variable is found or undefined.

### Static Private getHttpsEnvVariables

- getHttpsEnvVariables(): string | undefined

- - Defined in @zowe/imperative/src/rest/src/client/ProxySettings.ts:164

  Parses environment variables valid for https requests.

  static
  memberof

    ProxySettings

  #### Returns string | undefined

  `string` if valid variable is found or undefined.

### Static Private getNoProxyEnvVariables

- getNoProxyEnvVariables(): string[] | undefined

- - Defined in @zowe/imperative/src/rest/src/client/ProxySettings.ts:176

  Parses environment variables valid for no proxy exceptions.

  static
  memberof

    ProxySettings

  #### Returns string[] | undefined

  `string[]` of all hostnames found in the comma separated list in lowercase without white spaces.

### Static getProxyAgent

- getProxyAgent(session: ISession): Agent | undefined

- - Defined in @zowe/imperative/src/rest/src/client/ProxySettings.ts:49

  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 getProxyAuthHeader

- getProxyAuthHeader(proxySetting: ProxySetting): {} | undefined

- - Defined in @zowe/imperative/src/rest/src/client/ProxySettings.ts:104

  #### Parameters

  - ##### proxySetting: ProxySetting

  #### Returns {} | undefined

### Static Private getProxySettings

- getProxySettings(session: ISession): ProxySetting | undefined

- - Defined in @zowe/imperative/src/rest/src/client/ProxySettings.ts:120

  Parses environment variables for proxy servers.

  static
  memberof

    ProxySettings

  #### Parameters

  - ##### session: ISession

    Zowe `ISession` containing the hostname for the http request.

  #### Returns ProxySetting | undefined

  instance of private `ProxySetting` or `undefined`

### Static getSystemProxyUrl

- getSystemProxyUrl(session: ISession): URL | undefined

- - Defined in @zowe/imperative/src/rest/src/client/ProxySettings.ts:77

  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

- - Defined in @zowe/imperative/src/rest/src/client/ProxySettings.ts:92

  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