Skip to main content

Reverse Proxy

The reverse proxy handler forwards incoming HTTP requests to an upstream server. This is useful for integrating external web applications hosted on the same machine or network.

Configuration

sites:
  - domain: "api.example.com"
    proxy: "http://localhost:3000"

Requests to api.example.com are forwarded to http://localhost:3000, preserving the original request path and query string.

How It Works

  1. ZyveraWeb receives an HTTP request on the proxy domain.
  2. The request is forwarded to the upstream server using Java's HTTP client.
  3. The upstream response is relayed back to the client.

The proxy also injects standard forwarding headers:

  • X-Forwarded-For — Client IP address
  • X-Forwarded-Host — Original Host header from the client
  • X-Forwarded-Protohttp or https depending on the connection

Hop-by-hop headers (like Connection and Transfer-Encoding) are automatically stripped.

Use Cases

  • External web app — Proxy to a web application running on another port.
  • Legacy service — Route specific domains to older services.
  • Microservices — Split functionality across multiple backend processes.

Example: Multiple Proxied Services

sites:
  - domain: "api.example.com"
    proxy: "http://localhost:3000"

  - domain: "admin.example.com"
    proxy: "http://localhost:8081"

  - domain: "grafana.example.com"
    proxy: "http://localhost:3001"