CallMeTechie
DE Login
Home Products Blog About Contact

HTTP vs. L4 Routing — When to Use Which?

🌐 Networking & Routing · Updated 3 weeks ago

HTTP vs. L4 Routing — When to Use Which?

GateControl supports two routing types: HTTP Routing (Layer 7) for domain-based routing with all HTTP features, and L4 Routing (Layer 4) for raw TCP/UDP port forwarding.

Quick Rule

If the service is accessed in a browser (HTTP/HTTPS), use HTTP Routing. If it's a non-HTTP protocol (SSH, database, game server), use L4 Routing.

Feature Comparison

FeatureHTTP (Layer 7)L4 (Layer 4)
Routing methodDomain-basedPort-based
HTTPS / Let's EncryptYesOnly with TLS Terminate
CompressionYesNo
Rate LimitingYesNo
Auth (Basic/Route)YesNo
Peer ACLYesNo
Retry / Circuit BreakerYesNo
Uptime MonitoringHTTP CheckTCP Check
WebSocketYes (Upgrade)Yes (as TCP)

Typical L4 Use Cases

  • Minecraft Server: TCP, Port 25565, TLS: None
  • SSH Access: TCP, Listen Port 2222 → Target Port 22
  • Database: TCP, Listen Port 5433 → Target Port 5432
  • Game Server (UDP): UDP, Port 27015

L4 TLS Modes

ModeDescription
NoneNo TLS, raw TCP/UDP traffic
PassthroughTLS passed through, end-to-end encryption
TerminateCaddy terminates TLS with Let's Encrypt, backend gets unencrypted TCP

Important

  • L4 routes use exclusive ports (with TLS None)
  • Multiple L4 routes with TLS can share the same port (SNI-based)
  • L4 routes have no HTTP features

WebSocket Support

HTTP Routes: WebSocket connections start as a regular HTTP request with a Connection: Upgrade header. Caddy detects this automatically and switches to a persistent WebSocket connection — no configuration needed.

L4 Routes: Since L4 forwards the raw TCP stream, WebSocket works here too — Caddy forwards TCP packets 1:1.

Cookie Settings

We use cookies to improve your experience. Essential cookies are always active.

Privacy Policy
ESC
↑↓ navigate open esc close