On the same Machine 1, n8n is available at http://192.168.1.14:5678 and should be exposed as automation.yourdomain.com. FRP supports multiple [[proxies]] entries in one frpc.toml, all mapped to different domains.
Edit ~/frp-client/frpc.toml on Machine 1:
cd ~/frp-client
cat > frpc.toml << EOF
serverAddr = "150.265.32.125"
serverPort = 7000
[[proxies]]
name = "immich"
type = "http"
localIP = "192.168.1.14"
localPort = 2283
customDomains = ["yourdomain.com"]
[[proxies]]
name = "n8n"
type = "http"
localIP = "192.168.1.14"
localPort = 5678
customDomains = ["automation.yourdomain.com"]
hostHeaderRewrite = "automation.yourdomain.com"
EOF
The hostHeaderRewrite directive is taken directly from FRP's header modification docs and ensures that the Host header reaching n8n is exactly what n8n expects.
Restart frpc:
docker compose down
docker compose up -d
docker logs frpc
On the VPS, extend your Caddyfile:
cd ~/frp-server
cat > Caddyfile << EOF
yourdomain.com {
reverse_proxy localhost:8080
}
automation.yourdomain.com {
reverse_proxy localhost:8080 {
header_up Host automation.yourdomain.com
}
}
EOF
docker compose restart caddy
Add DNS for the new subdomain:
Type: A
Name: automation
IPv4: 150.265.32.125
Proxy: DNS only
Then test:
https://automation.yourdomain.com
If you encounter redirect loops with n8n, they almost always come from incorrect Host/Proto headers or misaligned n8n base URL configuration. Using hostHeaderRewrite on frpc and header_up Host in Caddy removes that class of problem.