Hello anyone doing their own VPS or self-hosting. I'm having a persistent issue with my self-hosted n8n instance on a VPS.
The production webhook URL is always being generated as:
But I want it to be clean, like this:
My Current Setup:
- VPS on Hetzner (Docker + Docker Compose)
- Reverse proxy with Caddy (handles HTTPS, port 443)
- n8n runs in Docker on port 5678 (internal HTTP)
What I Have Tried:
- Changed .env settings
N8N_PORT=5678
N8N_PROTOCOL=https
2. Updated docker-compose.yml
services:
n8n:
image: n8nio/n8n:latest
ports:
- "5678:5678"
environment:
- N8N_HOST=${N8N_HOST}
- N8N_PORT=${N8N_PORT}
- N8N_PROTOCOL=${N8N_PROTOCOL}
- WEBHOOK_URL=${WEBHOOK_URL}
- WEBHOOK_TUNNEL_URL=${WEBHOOK_TUNNEL_URL}
3.Edited Caddyfile for clean HTTPS
header {
X-Frame-Options "DENY"
X-XSS-Protection "1; mode=block"
X-Content-Type-Options "nosniff"
Referrer-Policy "strict-origin-when-cross-origin"
Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
}
}
4. Cleared Docker volumes and restarted multiple times
The Problem:
✅ Any Ideas? What am I missing?
- Is there a better way to force n8n to generate clean HTTPS URLs?
- Should I use N8N_CONFIG_FILES with a JSON config?
- Does this require a direct Nginx setup instead of Caddy?
Would appreciate any help or tips. Thanks! 🙏