From 22769977e3366dff64250509c0185a240ade76b8 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Sat, 21 Mar 2026 02:12:24 +0000 Subject: [PATCH] fix: clarify that advanced_config requires Caddy JSON, not Caddyfile syntax --- .../internal/api/handlers/proxy_host_handler.go | 4 ++-- frontend/src/components/ProxyHostForm.tsx | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/backend/internal/api/handlers/proxy_host_handler.go b/backend/internal/api/handlers/proxy_host_handler.go index dc73a462..6149e47d 100644 --- a/backend/internal/api/handlers/proxy_host_handler.go +++ b/backend/internal/api/handlers/proxy_host_handler.go @@ -358,7 +358,7 @@ func (h *ProxyHostHandler) Create(c *gin.Context) { if host.AdvancedConfig != "" { var parsed any if err := json.Unmarshal([]byte(host.AdvancedConfig), &parsed); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": "invalid advanced_config JSON: " + err.Error()}) + c.JSON(http.StatusBadRequest, gin.H{"error": "advanced_config must be valid Caddy JSON (not Caddyfile syntax). See https://caddyserver.com/docs/json/ for the correct format."}) return } parsed = caddy.NormalizeAdvancedConfig(parsed) @@ -586,7 +586,7 @@ func (h *ProxyHostHandler) Update(c *gin.Context) { if v != "" && v != host.AdvancedConfig { var parsed any if err := json.Unmarshal([]byte(v), &parsed); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": "invalid advanced_config JSON: " + err.Error()}) + c.JSON(http.StatusBadRequest, gin.H{"error": "advanced_config must be valid Caddy JSON (not Caddyfile syntax). See https://caddyserver.com/docs/json/ for the correct format."}) return } parsed = caddy.NormalizeAdvancedConfig(parsed) diff --git a/frontend/src/components/ProxyHostForm.tsx b/frontend/src/components/ProxyHostForm.tsx index 19d7f246..0a77144f 100644 --- a/frontend/src/components/ProxyHostForm.tsx +++ b/frontend/src/components/ProxyHostForm.tsx @@ -1388,11 +1388,23 @@ export default function ProxyHostForm({ host, onSubmit, onCancel }: ProxyHostFor id="advanced-config" value={formData.advanced_config} onChange={e => setFormData(prev => ({ ...prev, advanced_config: e.target.value }))} - placeholder="Additional Caddy directives..." + placeholder='{"handler": "headers", "request": {"set": {"X-Custom": ["value"]}}}' rows={4} className="w-full bg-gray-900 border border-gray-700 rounded-lg px-4 py-2 text-white font-mono text-sm focus:outline-none focus:ring-2 focus:ring-blue-500" /> +

+ Accepts{' '} + + Caddy JSON + + {' '}format only — not Caddyfile syntax. +

{/* Enabled Toggle */}