Back to Linter
Infobest practice

Single Server in Upstream

When to use upstream blocks vs direct proxy_pass in Nginx.

What This Rule Checks

This rule detects upstream blocks that contain only one server.

Why It Matters

An upstream block with a single server adds configuration complexity without providing load balancing or failover benefits. A direct `proxy_pass` to the server is simpler. However, an upstream can still be useful for keepalive connections to the backend.

Bad — Triggers this rule

upstream backend {
    server 10.0.0.1:3000;
}

location / {
    proxy_pass http://backend;
}

Good — Passes this rule

# Either use proxy_pass directly:
location / {
    proxy_pass http://10.0.0.1:3000;
}

# Or add more servers for redundancy:
upstream backend {
    server 10.0.0.1:3000;
    server 10.0.0.2:3000;
}

How to Fix

Either add more servers to the upstream block for redundancy, or remove the upstream and use `proxy_pass` directly.

Related Rules

Check your config now

Paste your nginx.conf and get instant feedback on 20+ rules.

Open Linter →