Middleware Stacks

Middleware Stacks in Qpoint Proxy allow for the injection of custom functionalities such as metrics collection, performance monitoring, traffic logging, and more. These functionalities are implemented using WebAssembly (WASM) modules, providing a flexible and powerful way to extend the proxy’s capabilities.

Middleware Stacks require SSL/TLS Termination.

Configuring Middleware Stacks

Middleware stacks are defined in the stacks section of the proxy-config.yaml file. Each stack consists of a list of middleware modules that are applied to the traffic passing through the proxy.

Example Stack Configuration

Below is an example of a stack configuration that includes two middleware modules:

      - name: duration-micro
        config: "us"
        wasm: "docker://us-docker.pkg.dev/qpoint-edge/public/middleware/http_duration:0bb591c"
      - name: report
        wasm: "/path/to/local/report.wasm"
      - name: duration-milli
        config: "ms"
        wasm: "docker://us-docker.pkg.dev/qpoint-edge/public/middleware/http_duration:0bb591c"
      - name: report
        wasm: "/path/to/local/report.wasm"
  • stacks: Top-level section defining all middleware stacks.

  • default, complete: Names of the stacks.

  • middlewares: List of middleware modules in each stack.

    • name: Descriptive name of the middleware.

    • config: Configuration parameters for the middleware.

    • wasm: Path to the WebAssembly module, either a local path or a remote URI.

Applying Middleware Stacks to Endpoints

Middleware stacks are applied to specific endpoints by referencing the stack name in the endpoint configuration. This allows for flexible and targeted application of middleware functionalities.

Example Endpoint Configuration with Stack

  audit_logs: stdout # Where to publish Audit Logs
  tls_ca_crt: "PEM or file://global_ca_cert.pem"  # Path or inline CA certificate
  tls_ca_key: "PEM or file://global_ca_key.pem"  # Path or inline CA key
  default_domain_action: ALLOW
    - domain: "api.example.com"
      action: DENY
        - ip:
      stack: complete  # Reference to the 'complete' stack
    - domain: "api.github.com"
      action: DENY
        - ip:
      stack: default  # Reference to the 'default' stack

Practical Use Cases

  1. Metrics Collection: Use the duration-micro middleware to measure the time taken for each request, providing valuable performance metrics.

  2. Traffic Logging: Use the report middleware to log and forward request details for monitoring and analysis.

  3. Custom Processing: Develop and deploy custom WASM modules to implement specific functionalities such as request modification, authentication, or data transformation.

Last updated