{
  "protocol": "kkokk-ago-twin-v5",
  "type": "pillar_guide",
  "site": "143",
  "domain": "makerskorean.net",
  "slug": "caddy-nginx-realip-reverse-proxy",
  "lang": "en",
  "canonical_url": "https://makerskorean.net/en/blueprints/caddy-nginx-realip-reverse-proxy/",
  "language_urls": {
    "ko": "https://makerskorean.net/blueprints/caddy-nginx-realip-reverse-proxy/",
    "en": "https://makerskorean.net/en/blueprints/caddy-nginx-realip-reverse-proxy/",
    "ja": "https://makerskorean.net/ja/blueprints/caddy-nginx-realip-reverse-proxy/",
    "zh": "https://makerskorean.net/zh/blueprints/caddy-nginx-realip-reverse-proxy/",
    "es": "https://makerskorean.net/es/blueprints/caddy-nginx-realip-reverse-proxy/"
  },
  "published_at": "2026-11-21",
  "updated_at": "2026-11-30",
  "title": "Single Public IP Hosting: Caddy Auto-TLS + Upstream Nginx Real-IP Architecture",
  "summary": "Terminating automatic HTTPS certificates on a dedicated Caddy gateway while preserving true client IPs and clean 301 headers on upstream Nginx servers.",
  "tldr": "Terminating automatic HTTPS certificates on a dedicated Caddy gateway while preserving true client IPs and clean 301 headers on upstream Nginx servers. [TLS Edge: Node 103 Caddy Auto-TLS 1.3 · Client IP Restore: set_real_ip_from 192.168.10.103 · Clean 301 Header: absolute_redirect off]",
  "sections": [
    {
      "heading": "1. Technical Deep Dive & Measured Mechanism",
      "body": "Centralizing TLS 1.3 / HTTP/3 termination on one Caddy gateway eliminates scattered certbot cronjobs across internal VMs while simplifying multi-domain routing."
    },
    {
      "heading": "2. Technical Deep Dive & Measured Mechanism",
      "body": "Without ngx_http_realip_module configured to trust the Caddy proxy IP, Nginx sees every external request as LAN traffic—breaking IP allowlists. Enabling real_ip_header X-Forwarded-For restores accurate WAN 403 blocking."
    },
    {
      "heading": "3. Technical Deep Dive & Measured Mechanism",
      "body": "Because upstream Nginx listens on port 80 behind HTTPS Caddy, setting absolute_redirect off ensures 301 redirects emit clean relative paths (e.g., Location: /episodes/) without leaking http:// schemes."
    },
    {
      "heading": "4. Field Verification Checklist, Pitfall Prevention & Continuous Audit",
      "body": "Deploying this workflow across KKOKK+W (makerskorean.net) proved that the most reliable engineering discipline is 'record baseline -> adjust one variable at a time -> run automated smoke verification'. Changing multiple parameters simultaneously obscures root causes. Use the benchmark matrix below as your starting reference, tune incrementally for your specific hardware, and re-verify latency, memory footprint, and 0.00 CLS stability after every change."
    }
  ],
  "metrics": [
    [
      "TLS Edge",
      "Node 103 Caddy Auto-TLS 1.3",
      "Zero manual cert renewals"
    ],
    [
      "Client IP Restore",
      "set_real_ip_from 192.168.10.103",
      "Accurate WAN 403 ACL enforcement"
    ],
    [
      "Clean 301 Header",
      "absolute_redirect off",
      "Preserves HTTPS scheme cleanly"
    ],
    [
      "Proxy Overhead",
      "< 0.4ms over 1GbE LAN",
      "Negligible latency impact"
    ]
  ],
  "faqs": [
    {
      "q": "Is it safe to apply these settings directly on an active setup?",
      "a": "Yes—follow Section 4 by capturing a quick config backup or snapshot first and applying changes one parameter at a time."
    },
    {
      "q": "Are the benchmark tables identical across all five languages?",
      "a": "Yes, every table and technical note is embedded in our 5-language bundle for instant switching on desktop and mobile."
    }
  ]
}