Skip to main content
Servers Are Up
Virtual Datacenter
PricingFree Tools
Sign inBrowse catalog
Servers Are Up
Virtual Datacenter
PricingFree Tools
Sign inBrowse catalog

Loading…

Servers Are Up

Your apps, automation and data on hardware we own. Build a private stack with predictable capacity and access through your dashboard, API or SSH.

SLA with service creditsOwned hardwareUS-based

Make room for your next idea

Explore the capacity, apps and access options that fit your workload. Check current availability and your total before you buy.

Sign up freeView Pricing

Products

  • Linux VPS
  • Windows VPS
  • Cloud & SaaS Services
  • Cloud Storage (Azure)
  • Virtual Datacenter
  • AI & Agent Hosting
  • Containers
  • Instant Apps
  • Software Platforms
  • Network builder
  • Game Servers
  • Free Game Servers
  • Pricing

Resources

  • Free Network Tools
  • 2026 Pricing Benchmark
  • Live SVG Badges
  • Latency & Speed Test
  • Guides & Tutorials
  • Documentation
  • API Reference
  • MCP Server
  • CLI & SDKs
  • OpenAPI & llms.txt
  • Use Cases
  • Free Migration
  • Uptime & Reliability
  • Datacenter
  • System Status
  • Network
  • Provider Comparisons Hub
  • Compare Providers

Company

  • About Us
  • Enterprise
  • Security Architecture
  • Trust Center
  • Blog
  • FAQ
  • Compliance
  • Startup Program
  • Open-Source Sponsorship
  • Press & Media Kit
  • Referral Program
  • Help Center
  • Contact Us
© Servers Are Up
TermsPrivacySLARefund PolicyDPAAcceptable Use
Service information
Docs
  • Documentation Hub
  • Technical Knowledge Library
    Runbooks & 187 Blueprints
  • Choose a Product
    VMs, Containers & Cloud
  • First Linux Server
    SSH, Firewall & Apps
  • Windows Server 2025
    BYOL & Remote Desktop
  • Remote Access
  • Troubleshooting
  • FAQ
  • All Product Guides
    29 Step-by-Step Guides
  • Cloud & SaaS Catalog
    112 Cloud & SaaS Offerings
  • Azure Cloud Storage
    Hot/Cool/Archive & WORM
  • Resource Manager & RBAC
    Groups, Tags & Locks
  • Multi-Model Cloud DB
    JSONB, SQL & pgvector
  • Cloud Identity & ZTNA
    OIDC, SCIM & PIM
  • Key Vault & KMS
    Secrets & Envelope Keys
  • Cloud SIEM, SOAR & DLP
    Posture & Threat Response
  • API Gateway & Cloud DNS
    Edge WAF & DNS Zones
  • Serverless, Workflows & IoT
    Functions, Queues & DAGs
  • SaaS, Governance & Vault
    Budgets & Off-Host GRS
  • Linux Systems & Kernel
    SSH, UFW, sysctl & OOM
  • Self-Hosted Apps & Stacks
    Caddy, Nextcloud & Auth
  • Build Web Apps with AI
  • Next.js and React
  • TypeScript and Node.js
  • npm and Tooling
  • Data and APIs
  • Deploy and Operate
  • Tutorials
  • Infrastructure
  • Automation & Regions
  • API Overview
  • API v1 Reference
    Endpoints & 23 Scopes
  • MCP Server
    129 AI Agent Tools
  • Swagger / OpenAPI 3.1
  • API Playground
  • Versioning & Sunset
  • API Token Security
    Authentication & Tokens
  • Instances API
    Compute Resources
  • Networking API
    Networks & Ports
  • Storage API Availability
    Volumes & Backups
  • Webhooks & Events
    Event Notifications
  • Rate Limits & Best Practices
    Throttling & Retries
  • sau CLI Reference
    34 Commands (v0.2)
  • Browser Web CLI
  • SDKs
  • Infrastructure as Code
    Terraform & Ansible
  • Code Examples
  • CLI & SDK Guides
  • Security Guides
  • Security at a Glance
  • Zero Trust Architecture
  • Live Trust Center
  • Compliance
Need help?

Loading documentation...

Documentation/self hosted apps

Configure Caddy and Traefik reverse proxies reliably

Terminate HTTPS automatically and pass X-Forwarded headers, trusted proxy ranges, large upload streams, and WebSocket upgrades with Caddy or Traefik.

Intermediate
25 min
Updated 2026-11-23

Deploy Ready-to-Run Infrastructure in Seconds

Linux VMs from $6/mo · Pooled Virtual Datacenters from $12/mo · Use code WELCOME20 for 20% off your first order.

Browse ServersView Pricing

Commands checked on 2026-11-23 with Caddy 2.9+, Traefik v3.2+, Docker Compose v2, Ubuntu 24.04.

What you will have at the end

A production-ready reverse proxy fronting Docker services with automated Let's Encrypt TLS, preserved client IP headers (X-Forwarded-For, X-Forwarded-Proto), working WebSocket upgrades, and clear separation between public and internal bridge networks.

Before you start

  • A Linux server with Docker Compose v2 and DNS A/AAAA records pointing app.YOUR_DOMAIN to the server's public IP; see Managed Docker first stack.
  • Firewall ports 80/tcp and 443/tcp open cleanly on host DOCKER-USER as shown in Fix Docker UFW bypasses with DOCKER-USER and nftables.

Steps

1. Create a shared external proxy network and internal backend network

Split reverse-proxied app ports from database networks so Postgres, Redis, and Ollama never sit on the proxy bridge:

docker network create proxy_net

In your stack's docker-compose.yml, attach public-facing web containers to both proxy_net and a stack-local internal: true network.

2. Configure Caddy with Cloudflare-aware trusted_proxies and hardening headers

Caddy automatically forwards X-Forwarded-For, X-Forwarded-Proto, X-Forwarded-Host, and upgrades WebSockets out of the box. When placing Caddy behind Cloudflare or an upstream L7 proxy, configure trusted_proxies globally so real visitor IPs are preserved instead of rewritten:

{
    email admin@YOUR_DOMAIN
    servers {
        trusted_proxies static private_ranges
        client_ip_headers X-Forwarded-For CF-Connecting-IP
    }
}

app.YOUR_DOMAIN {
    encode zstd gzip
    reverse_proxy app-service:3000 {
        flush_interval -1
        transport http {
            dial_timeout 10s
            response_header_timeout 120s
        }
    }
    header {
        Strict-Transport-Security "max-age=31536000; includeSubDomains"
        X-Content-Type-Options "nosniff"
        X-Frame-Options "SAMEORIGIN"
        Referrer-Policy "strict-origin-when-cross-origin"
        -Server
    }
}

Use flush_interval -1 for AI streaming (SSE), Next.js streaming responses, n8n, or terminal consoles so chunks reach the browser immediately without proxy buffering.

3. Deploy Caddy cleanly in Docker Compose

services:
  caddy:
    image: caddy:2.9-alpine
    container_name: edge-caddy
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - caddy_data:/data
      - caddy_config:/config
    networks:
      - proxy_net

networks:
  proxy_net:
    external: true

volumes:
  caddy_data:
  caddy_config:

4. Configure Traefik v3 dynamic Docker labels and WebSocket resilience

When using Traefik v3 via labels, pin docker.network=proxy_net explicitly so multi-homed containers never route to an isolated internal subnet IP:

services:
  immich-server:
    image: ghcr.io/immich-app/immich-server:release
    networks:
      - proxy_net
      - internal_net
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=proxy_net"
      - "traefik.http.routers.immich.rule=Host(`photos.YOUR_DOMAIN`)"
      - "traefik.http.routers.immich.entrypoints=websecure"
      - "traefik.http.routers.immich.tls.certresolver=letsencrypt"
      - "traefik.http.services.immich.loadbalancer.server.port=2283"

Extend Traefik --entrypoints.websecure.transport.respondingTimeouts.readTimeout=600s when serving multi-gigabyte media uploads (Immich, Nextcloud, Seafile).

Check that it works

Validate Caddy syntax, reload safely, and verify HTTP-to-HTTPS redirect and WebSocket/TLS headers from outside:

docker exec edge-caddy caddy validate --config /etc/caddy/Caddyfile
docker exec edge-caddy caddy reload --config /etc/caddy/Caddyfile
curl -sIL https://app.YOUR_DOMAIN

You should observe HTTP/2 200 (or expected app redirect) plus strict-transport-security and x-content-type-options: nosniff.

What can go wrong

  • 502 Bad Gateway intermittently on multi-network containers. Traefik or Caddy resolved the container's internal_net IP it cannot reach, or the app is bound to 127.0.0.1 inside its container instead of 0.0.0.0. Set traefik.docker.network=proxy_net and ensure upstream services listen on 0.0.0.0.
  • Apps log 172.x.0.1 instead of real client IPs or trigger redirect loops. The backend app doesn't trust the proxy subnet. Add 172.16.0.0/12 to the app's trusted_proxies / TRUSTED_PROXY_CIDRS.
  • 413 Payload Too Large or dropped chunked uploads. An Nginx layer or CDN in front caps body size. In Nginx proxies set client_max_body_size 0; and proxy_request_buffering off;; on Cloudflare-proxied uploads keep chunks under 100 MB (Nextcloud/Immich clients auto-chunk).

Good practice

  • Always persist /data in Caddy (or acme.json 0600 in Traefik) so ACME certificates survive container recreation without hitting Let's Encrypt rate limits.
  • Keep Caddyfile readable only by root and mount :ro inside the proxy container.
  • Pair proxy routes with app-specific trusted_proxies configs before enabling external registrations.

Where to go next

  • Production setup for Nextcloud, Immich, and Vaultwarden
  • Wire Authentik, Gitea, and n8n cleanly behind a reverse proxy
  • Fix Docker UFW bypasses with DOCKER-USER and nftables

Related Articles

Wire Authentik, Gitea, and n8n cleanly behind a proxy

Read more

Deploy Grafana, VictoriaMetrics, and Uptime Kuma cleanly

Read more

Run Nextcloud, Immich, and Vaultwarden reliably behind proxies

Read more

Frequently Asked Questions

What does the Configure Caddy and Traefik reverse proxies reliably documentation guide cover?
Terminate HTTPS automatically and pass X-Forwarded headers, trusted proxy ranges, large upload streams, and WebSocket upgrades with Caddy or Traefik. It is rated intermediate difficulty (25 min) and applies to Servers Are Up infrastructure and workflows.
Can I manage or automate these steps through the Servers Are Up dashboard, REST API v1, or MCP server?
Yes. Every Servers Are Up server includes browser-based SSH, WebRDP, and VNC console access in the dashboard, plus programmatic control via the REST API v1 (/api/v1) and hosted Model Context Protocol server (/api/mcp/v1) using a scoped Personal Access Token.

Need hands-on help with Configure Caddy and Traefik reverse proxies reliably?

Every Servers Are Up virtual machine and container includes an integrated HTML5 browser-based SSH, RDP, and VNC console in your dashboard, default-off inbound firewall rules with per-IP allow-lists, and full programmatic control via REST API v1 and Model Context Protocol (MCP). Explore our Virtual Datacenter Plans or reach out to Servers Are Up Support.

Was this article helpful?

On this page

What you will have at the endBefore you startSteps1. Create a shared external proxy network and internal backend network2. Configure Caddy with Cloudflare-aware trusted_proxies and hardening headers3. Deploy Caddy cleanly in Docker Compose4. Configure Traefik v3 dynamic Docker labels and WebSocket resilienceCheck that it worksWhat can go wrongGood practiceWhere to go next
Need Live Commands?

Open Aria in Wide Engineering Mode for distro-specific commands, compose tweaks, and isolated environment troubleshooting.

Knowledge Library