How To Fix Error 54113 Varnish Cache Server

The Error 54113 from a Varnish Cache Server is typically a backend connection error, which means Varnish couldn’t reach your origin server (backend) or received an invalid response.

It’s often associated with HTTP 503 Service Unavailable errors but is more specific to Varnish setups.


🧠 What Is Error 54113 in Varnish?

  • Varnish Error 54113 means:

    Varnish tried to fetch content from the backend (your web server like Apache, NGINX, etc.) but failed, so it couldn’t serve anything to the client.

  • You might see this message:

    Error 54113
    Varnish cache server

🔧 How to Fix Error 54113 – Step-by-Step

✅ 1. Check Backend Server Status

Make sure your origin server is actually running and accepting connections.

  • If you use Apache: sudo systemctl status apache2

  • If you use NGINX: sudo systemctl status nginx

📌 If it’s down, restart it:

sudo systemctl restart apache2
# or
sudo systemctl restart nginx

Also Read : EZ Pass Text Scam | Key Red Flags


✅ 2. Check Backend Port & Configuration

Varnish needs to connect to the right port where your backend is serving content.

  • Open your Varnish config file (usually /etc/varnish/default.vcl)

  • Look for the backend definition:

backend default {
.host = "127.0.0.1";
.port = "8080";
}
  • Ensure the backend service (like Apache or NGINX) is actually running on that port.
    Example: Apache might default to port 80, but Varnish is trying 8080.

🔍 Test with:

curl http://127.0.0.1:8080

If it fails, there’s your problem.


✅ 3. Check for Backend Timeouts

Sometimes the backend is slow or returns incomplete headers, triggering a fetch failure.

  • Increase timeout values in default.vcl:

backend default {
.host = "127.0.0.1";
.port = "8080";
.connect_timeout = 5s;
.first_byte_timeout = 10s;
.between_bytes_timeout = 5s;
}

Then reload Varnish:

sudo systemctl reload varnish

✅ 4. Check Varnish Logs

Use varnishlog or journalctl to see exactly why it failed:

sudo varnishlog

Look for lines like:

FetchError backend connection failure

This will give exact details — like timeout, reset, bad response, etc.


✅ 5. Check for Bad Headers or Responses

Varnish is picky — if your backend sends malformed headers, it may reject the response.

Use curl -I or a browser tool to inspect headers:

curl -I http://127.0.0.1:8080

Check for:

  • Missing Content-Length

  • Invalid status codes

  • Encoding issues


✅ 6. Restart Services in Order

Sometimes Varnish is started before the backend is ready.

Restart both in order:

sudo systemctl restart apache2
sudo systemctl restart varnish

🧰 Quick Summary: Fixing Error 54113

StepFix
1Check if backend server is up
2Make sure Varnish is pointing to the right port
3Test backend with curl
4Review Varnish logs for fetch errors
5Increase timeout values
6Restart Varnish after backend is ready

Be the first to comment

Leave a Reply