Nginx Non-standard Status Silent Connection Close
Luke Hebert
- 3 minutes read - 449 wordsIf you have ever wanted Nginx to drop a connection without giving the client any HTTP status code to work with, code 444 is the tool for the job. It is a non-standard, Nginx-specific status code that instructs the server to close the TCP connection immediately, so the client sees a reset or timeout rather than a normal response.
What Code 444 Does
When Nginx encounters a return 444; directive, it:
- Closes the connection without writing any response headers or body.
- Does not log a standard HTTP status line (the log will show
444as the status, but the client never receives it). - Avoids revealing server software, version, or any other details that a normal 403 or 404 might expose.
Because it is not defined in RFC 7231 or any other HTTP standard, no browser or HTTP client will ever interpret it as a meaningful status. The client simply sees the connection go away.
Common Use Cases
- Blocking bad bots or scrapers that you do not want to acknowledge.
- DDoS mitigation where you want to shed load without feeding attackers a response.
- Silent rate limiting for clients that exceed a threshold.
- Dropping malformed or suspicious requests without confirming the endpoint exists.
Example Configuration
server {
listen 80;
server_name example.com;
# Silently drop requests from a known-bad IP range
location / {
if ($remote_addr ~ ^203\.0\.113\.) {
return 444;
}
proxy_pass http://backend;
}
}After making changes, reload Nginx to apply them:
sudo nginx -t && sudo systemctl reload nginxThings to Keep in Mind
Code 444 is specific to Nginx. It will not work in Apache, Caddy, or any other web server. If you are writing a shared configuration or a reverse-proxy rule that must be portable, stick to standard status codes.
- Logging: Nginx will still record the request in its access log with a status of
444, which is useful for auditing. - Client experience: Depending on the client, the connection close may surface as a
Connection reset by peererror, a timeout, or a generic network failure. There is no HTTP status to display. - Keep-alive connections: If the client is using HTTP/1.1 keep-alive, the abrupt close can cause the client to retry the request on a new connection. Pair 444 with a short
keepalive_timeoutif that becomes a concern.
Verifying It Works
Send a request from a test client and confirm that no response body or headers arrive:
curl -v http://example.com/You should see the connection close without any HTTP/1.1 status line in the output.
Code 444 is a small but handy escape hatch in Nginx. Use it when you want the server to stay quiet, and the client to get nothing at all.