返回顶部
C

Caddy配置Caddy反向代理

Configure Caddy as a reverse proxy with automatic HTTPS and simple Caddyfile syntax.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
1,024
下载量
免费
免费
2
收藏
概述
安装方式
版本历史

Caddy

Caddy Configuration Rules

Automatic HTTPS

  • - Caddy provisions SSL certificates automatically — don't manually configure Let's Encrypt unless you have specific needs
  • Domain must resolve to the server publicly for HTTP challenge — use DNS challenge for internal/wildcard certs
  • Ports 80 and 443 must be free — Caddy needs both even for HTTPS-only (80 handles ACME challenges and redirects)
  • Let's Encrypt has rate limits — use staging CA during testing to avoid hitting production limits

Caddyfile Syntax

  • - Indentation is significant — blocks are defined by indentation, not braces in shorthand
  • Site blocks need a space before the opening brace: example.com { not INLINECODE1
  • Use caddy fmt --overwrite to fix formatting — catches most syntax issues
  • Validate before applying: INLINECODE3

Reverse Proxy

  • - Caddy adds X-Forwarded-For, X-Forwarded-Proto, X-Forwarded-Host automatically — don't add them manually
  • WebSocket works out of the box — no special configuration needed
  • Load balancing is automatic with multiple backends — default is random, use lb_policy to change
  • Passive health checks remove failed backends automatically

Docker Networking

  • - Use container names as hostnames: INLINECODE8
  • Caddy and backends must share a Docker network — default bridge doesn't support DNS resolution
  • For Docker Compose, service names work as hostnames when on the same network

Configuration Management

  • - Use caddy reload not restart — reload applies changes without dropping connections
  • Config changes are atomic — if new config fails validation, old config stays active
  • Test without applying: caddy adapt --config Caddyfile shows parsed JSON output

Certificate Storage

  • - Certificates stored in ~/.local/share/caddy by default — preserve this across reinstalls
  • For Docker, mount volumes for /data and /config — losing these means re-requesting all certificates
  • Multiple Caddy instances need shared storage or will fight over certificates

Debugging

  • - Enable debug logging: add debug as first line in global options block
  • Check certificate status in /data/caddy/certificates/ directory
  • Common issue: DNS not pointing to server yet — certificates fail silently until domain resolves

Security Headers

  • - Caddy doesn't add security headers by default — add X-Frame-Options, X-Content-Type-Options explicitly
  • HSTS is automatic when serving HTTPS — no manual configuration needed

Performance

  • - Handles thousands of concurrent connections without tuning
  • HTTP/3 available with INLINECODE16
  • Compression automatic for text content

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 caddy-1776419962 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 caddy-1776419962 技能

通过命令行安装

skillhub install caddy-1776419962

下载

⬇ 下载 Caddy v1.0.0(免费)

文件大小: 1.98 KB | 发布时间: 2026-4-17 20:10

v1.0.0 最新 2026-4-17 20:10
Initial release

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部