A dynamic HTTP response page can respond to all HTTP response codes defined in the Nginx source code src/http/ngx_http_header_filter_module.c
.
## Nginx source code file to extract HTTP response codes from
$ NGINX_SRC_URL="https://raw.githubusercontent.com/nginx/nginx/master/src/http/ngx_http_header_filter_module.c"
### Find values double quotes that match lines 'ngx_string("### '
$ curl --silent $NGINX_SRC_URL | egrep 'ngx_string\(\"[0-9]{3} .*\"' | cut -d\" -f2 | sort
# OUTPUTS
200 OK
201 Created
202 Accepted
...
Nginx Config
# in http {} block
error_page
301 302 303 304 307 308
400 401 402 403 404 405 406 408 409 410 411 412 413 414 415 416 421 429
500 501 502 503 504 505 507
@errors;
map $status $status_text {
default "Unknown error";
200 "OK";
201 "Created";
202 "Accepted";
204 "No Content";
206 "Partial Content";
301 "Moved Permanently";
302 "Moved Temporarily";
303 "See Other";
304 "Not Modified";
307 "Temporary Redirect";
308 "Permanent Redirect";
400 "Bad Request";
401 "Unauthorized";
402 "Payment Required";
403 "Forbidden";
404 "Not Found";
405 "Not Allowed";
406 "Not Acceptable";
408 "Request Time-out";
409 "Conflict";
410 "Gone";
411 "Length Required";
412 "Precondition Failed";
413 "Request Entity Too Large";
414 "Request-URI Too Large";
415 "Unsupported Media Type";
416 "Requested Range Not Satisfiable";
421 "Misdirected Request";
429 "Too Many Requests";
500 "Internal Server Error";
501 "Not Implemented";
502 "Bad Gateway";
503 "Service Temporarily Unavailable";
504 "Gateway Time-out";
505 "HTTP Version Not Supported";
507 "Insufficient Storage";
}
## in server {} block
location @errors {
internal;
default_type "text/plain; charset=utf-8";
return 200 "$status $status_text\n";
}