Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm configuring a failover server tasked to accept any incoming request, and reply with blank 200 response. The idea is to minimize the reply time and to ensure we dont send any 40x or 50x.

I tried using return 200; for the desired locations within Nginx, but my monitoring systems (Pingdom) didn't like the response, and consider the server not responding.

Is there a better way to do this, of course with minimal overhead on the server?

share|improve this question

migrated from Oct 12 '11 at 16:09

This question came from our site for professional and enthusiast programmers.

up vote 14 down vote accepted

HTTP status code 204 No Content is meant to say "I've completed the request, but there is no body to return":

10.2.5 204 No Content

The server has fulfilled the request but does not need to return an entity-body, and might want to return updated metainformation. The response MAY include new or updated metainformation in the form of entity-headers, which if present SHOULD be associated with the requested variant.

If the client is a user agent, it SHOULD NOT change its document view from that which caused the request to be sent. This response is primarily intended to allow input for actions to take place without causing a change to the user agent's active document view, although any new or updated metainformation SHOULD be applied to the document currently in the user agent's active view.

The 204 response MUST NOT include a message-body, and thus is always terminated by the first empty line after the header fields.

share|improve this answer
Hello Alex Thanks for the note. Just wondering if 204 response code is recognized by all major browsers these days. i.e. if my server start sending 204 around, is there any probability that some visitors (across browsers, mobiles, terminals) get an error? – Sparsh Gupta Oct 11 '11 at 14:07
@SparshGupta I'm not an expert in browser compatibility, sorry. I've made a quick check in a couple of browsers (FF 7 and Safari under Mac OSX) -- they do exactly nothing. For example, if you have a page already open, then you put an URL returning 204 into the address bar and hit Enter, both browsers still show that previous page. – Alexander Azarov Oct 11 '11 at 16:35

You can have nginx return back an empty HTTP 200 by a config block like:

location = /health {
  return 200;
  #access_log off;

You can uncomment the access_log line if you dont want all those health checks to be logged.

share|improve this answer
It should be noted that the '=' sign after location is important. Without it, that file must exist, otherwise nginx will not return 200. With it, you can just make up any location you want and not worry about files and nginx will happily return 200. – Florin Andrei May 29 '15 at 23:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.