Repository navigation
Feature Guide Proxy Hosts
Create and manage reverse proxies handled by Caddy.
- What Proxy Hosts Do
- Create a Proxy Host
- Domains and Upstreams
- List View Search and Pagination
- Advanced Features
- Examples
- Troubleshooting
A proxy host maps public domain(s) to one or more upstream services.
Common uses:
- Expose internal apps at public domains
- Terminate HTTPS automatically with Caddy-managed ACME certs
- Add HTTP basic auth via access lists
- Enforce geo-based allow/block rules
- Load balance across multiple upstreams
- Open Proxy Hosts in the sidebar.
- Click Create Host.
- Configure at minimum:
- Name
- Domains (one per line or comma-separated)
- Upstreams (one per line)
- Optional: choose a custom imported certificate or an access list.
- Click Create.
By default, a new host is created with Caddy-managed certificate handling.
You can define one or multiple domains per host.
Examples:
app.example.com
api.example.com
Wildcard example (requires DNS-01):
*.example.com
You can define one or multiple upstream targets.
Examples:
http://app:8080
http://app2:8080
https://backend.internal:8443
When multiple upstreams are defined, enable Load Balancer to control selection and health behavior.
The Proxy Hosts page uses server-side filtering and pagination.
- Search is available at the top of the page
- Search matches host name, domains, and upstream values
- Results are paged on the server
- Default page size:
25 - URL params are used (
?search=...&page=N) so links are shareable
Actions available from the list:
- Enable/disable host
- Duplicate host
- Edit host
- Delete host
Enable Load Balancer in the host dialog to configure:
- Policy:
random,round_robin,least_conn,ip_hash,first,header,cookie,uri_hash - Retry behavior: try duration, try interval, max retries
- Active health checks: URI, port, interval, timeout, expected status/body
- Passive health checks: fail duration, max fails, unhealthy status codes, unhealthy latency
Two DNS-related options are available per host:
- DNS Resolver: set explicit resolver(s), optional fallback resolver(s), and timeout
-
Upstream DNS Resolution: override pinning behavior (
ipv4,ipv6,both) when upstream hostnames are resolved on apply
Enable the built-in forward auth to protect a host with CPM's login portal. Choose which users and/or groups may access the host. No external IdP required.
See Feature Guide Forward Auth for full setup.
Per-host Authentik forward-auth settings can be enabled for protected routes, including copied identity headers and trusted proxies.
Protect a host through any forward-auth server with an Authelia preset, including the split browser vs API pattern: browser requests are redirected to the auth portal, API clients and WebSocket handshakes can get a plain 401, and requests carrying a bypass header (e.g. X-Api-Key) skip forward auth so the upstream can enforce its own API keys.
See Feature Guide Forward Auth for full setup.
Add path-based routing rules to send different URL paths to different upstreams. For example, /api/* to one backend and /ws/* to another. Each rule specifies a path prefix and one or more upstream targets.
The host dialog can also serve responses you write yourself:
- Error Pages: a custom body and content type for error status codes (e.g. 502/503 when the upstream is down); the original status code is kept
- Path Blocks: a status code and an optional body for blocked paths
- Redirects: from a path (From Path) to To URL / Path, with a status code
Global fallback error pages are configured under Settings → Error Pages, and the response for unknown hosts and direct IP access under Settings → Default Response.
Placeholders (since v1.13.1): in error page bodies and content types (per host and global), path block bodies, and the default response body, headers and redirect URL, Caddy request placeholders such as {http.request.uri} and {http.request.host} are still expanded, while host placeholders ({env.*}, {system.*} and {file.*}) are sent literally, exactly as written. For example, a default response redirect URL of https://{env.PRIMARY_DOMAIN}{http.request.uri} now sends {env.PRIMARY_DOMAIN} as text; write the host name out instead: https://www.example.com{http.request.uri}.
Per-host Redirects take no placeholders at all: CPM removes every {…} from From Path and To URL / Path when the host is saved, as older releases did. A target of https://www.example.com{http.request.uri} is stored as https://www.example.com.
When mTLS is enabled, you can add path-based access rules that restrict which client certificates (by role or individually) can reach specific URL paths.
See Feature Guide mTLS RBAC for full setup.
Enable the WAF per host in the host dialog. Three options:
- Disabled — WAF off for this host, regardless of global setting
- Global — use the global WAF settings (default)
- Custom — override with host-specific WAF settings (enable/disable, OWASP CRS, custom directives)
Custom mode also supports per-host rule suppression. Events from this host appear in WAF → Events filtered by host.
Custom directives are checked when you save the host: a newly added line that CPM would not send to Caddy (for example SecRuleRemoveByTag or ctl:ruleEngine=Off) is rejected with the reason (see Feature Guide WAF#accepted-and-dropped-directives).
See Feature Guide WAF for full WAF setup.
Configure allow/block rules by:
- Country
- Continent
- ASN
- CIDR
- IP
See Feature Guide Geo Blocking for full setup and rule strategy.
Advanced users can supply:
- Custom Pre-Handlers (JSON)
- Custom Reverse Proxy (JSON)
These are merged into generated Caddy configuration for edge cases.
Per-host options include:
- Enable/pause host
- Include HSTS subdomains
- Skip upstream HTTPS hostname validation (for specific self-signed/private PKI cases)
Domains:
app.example.com
Upstreams:
http://app:3000
Domains:
api.example.com
Upstreams:
http://api-1:8080
http://api-2:8080
Load balancer:
enabled=true
policy=round_robin
Domains:
*.example.com
Upstreams:
http://tenant-router:3000
Requires DNS-01 challenge support. See Cloudflare DNS Configuration.
Checks:
- Validate upstream is reachable from Caddy network
- Confirm container/service name and port
- Review Caddy logs:
docker compose logs caddy | grep -i upstream
Checks:
- Domain resolves to your server
- Ports
80/443are reachable (unless using DNS-01) - ACME email configured in Settings
- Inspect ACME logs:
docker compose logs caddy | grep -i acme
Since v1.13.1, host placeholders in error pages, path block bodies and the default response (body, headers and redirect URL) are not expanded (see Error Pages, Path Blocks and Redirects). Replace them with the literal value. Request placeholders such as {http.request.uri} still work there. Per-host redirect targets drop every {…} placeholder when the host is saved.
The list is server-rendered from URL params. If needed, clear search input and confirm search is removed from the URL.
- Certificate Management
- Feature Guide Access Lists
- Feature Guide Geo Blocking
- Cloudflare DNS Configuration
- Troubleshooting
Need help? Open an issue with your host configuration and relevant logs.