In some cases, we might need to throw a custom/different error code for a specific issue. For example, we can throw a different error to the end user even if the backend node is down. We can do that in nginx as in the example below.
server {
    listen       8080;
    server_name  devopslife.io;
    error_page   502 503 504 =204 /temperror;
    location /temperror {
      return 204;
    }
  }
Now the user will only see a 204 even if its 503 in real