API Docs for: 2.6
Show:

http_proxy Class

Module: http_proxy

Provides the HTTP and HTTPS proxy server.

Methods

config

(
  • path
)

Configurates the HTTPS proxy properties and the router url mappings. The file must use the JSON syntax.

The method can throw an Exception.

Parameters:

  • path String

    The path of the configuration file

getProxyLog

(
  • req
)
String private

Returns the string to log the REST request.

Parameters:

  • req Object

    The request object

Returns:

String:

The string describing the REST request.

proxyRequest

(
  • req
  • res
  • proxy
)

It routes the request to the correct service using the router property. Each request is authenticated before processing it, so the first time authentication request is needed and then each requests must contain the authentication token.

Parameters:

  • req Object

    The request object

  • res Object

    The response object

  • proxy Obejct

    The proxy to route the request

setCompAuthentication

(
  • ca
)

Sets the authentication architect component.

Parameters:

  • ca Object

    The authentication architect component.

setCompUtil

(
  • comp
)

Sets the utility architect component.

Parameters:

  • comp Object

    The utility architect component.

setLogger

(
  • log
)
static

Set the logger to be used.

Parameters:

  • log Object

    The logger object. It must have at least three methods: info, warn and error as console object.

start

() static

Starts the HTTP and HTTPS proxy servers.

startHttpProxy

() private

Starts the HTTP proxy server.

startHttpsProxy

() private

Starts the HTTPS proxy server.

Properties

compAuthentication

Object private

The authentication architect component.

compUtil

Object private

The utility architect component.

httpPort

String private

Listening port of the HTTP proxy server. It can be customized in the configuration file.

Default: "8179"

HTTPS_CERT

String private

The path of the certificate to be used by HTTPS server. It can be customized in the configuration file.

Default: "/etc/pki/tls/certs/localhost.crt"

HTTPS_KEY

String private

The path of key to be used by HTTPS server. It can be customized in the configuration file.

Default: "/etc/pki/tls/private/localhost.key"

httpsPort

String private

Listening port of the HTTPS proxy server. It can be customized in the configuration file.

Default: "8180"

IDLOG

String private final

The module identifier used by the logger.

Default: [http_proxy]

logger

Object private

The logger. It must have at least three methods: info, warn and error.

Default: console

router

Object private

The routing of the HTTPS proxy. It's initialized by the config method. It must be customized in the configuration file.

Default: {}