Skip to content

Instantly share code, notes, and snippets.

@dgolosov
Last active December 8, 2022 06:30
Show Gist options
  • Save dgolosov/d43957d97d41cc406e79ccd27a4bd0a5 to your computer and use it in GitHub Desktop.
Save dgolosov/d43957d97d41cc406e79ccd27a4bd0a5 to your computer and use it in GitHub Desktop.
NginX JSON Errors
error_page 400 /400.json;
location /400.json {
internal;
default_type application/json;
return 400 '{ "code": 400, "message":"Bad Request" }';
}
error_page 401 /401.json;
location /401.json {
internal;
default_type application/json;
return 401 '{ "code": 401, "message":"Unauthorized" }';
}
error_page 402 /402.json;
location /402.json {
internal;
default_type application/json;
return 402 '{ "code": 402, "message":"Payment Required" }';
}
error_page 403 /403.json;
location /403.json {
internal;
default_type application/json;
return 403 '{ "code": 403, "message":"Forbidden" }';
}
error_page 404 /404.json;
location /404.json {
internal;
default_type application/json;
return 404 '{ "code": 404, "message":"Not Found" }';
}
error_page 405 /405.json;
location /405.json {
internal;
default_type application/json;
return 405 '{ "code": 405, "message":"Method Not Allowed" }';
}
error_page 406 /406.json;
location /406.json {
internal;
default_type application/json;
return 406 '{ "code": 406, "message":"Not Acceptable" }';
}
error_page 407 /407.json;
location /407.json {
internal;
default_type application/json;
return 407 '{ "code": 407, "message":"Proxy Authentication Required" }';
}
error_page 408 /408.json;
location /408.json {
internal;
default_type application/json;
return 408 '{ "code": 408, "message":"Request Timeout" }';
}
error_page 409 /409.json;
location /409.json {
internal;
default_type application/json;
return 409 '{ "code": 409, "message":"Conflict" }';
}
error_page 410 /410.json;
location /410.json {
internal;
default_type application/json;
return 410 '{ "code": 410, "message":"Gone" }';
}
error_page 411 /411.json;
location /411.json {
internal;
default_type application/json;
return 411 '{ "code": 411, "message":"Length Required" }';
}
error_page 412 /412.json;
location /412.json {
internal;
default_type application/json;
return 412 '{ "code": 412, "message":"Precondition Failed" }';
}
error_page 413 /413.json;
location /413.json {
internal;
default_type application/json;
return 413 '{ "code": 413, "message":"Request Entity Too Large" }';
}
error_page 414 /414.json;
location /414.json {
internal;
default_type application/json;
return 414 '{ "code": 414, "message":"Request-URI Too Long" }';
}
error_page 415 /415.json;
location /415.json {
internal;
default_type application/json;
return 415 '{ "code": 415, "message":"Unsupported Media Type" }';
}
error_page 416 /416.json;
location /416.json {
internal;
default_type application/json;
return 416 '{ "code": 416, "message":"Requested Range Not Satisfiable" }';
}
error_page 417 /417.json;
location /417.json {
internal;
default_type application/json;
return 417 '{ "code": 417, "message":"Expectation Failed" }';
}
error_page 418 /418.json;
location /418.json {
internal;
default_type application/json;
return 418 '{ "code": 418, "message":"I\'m a teapot" }';
}
error_page 419 /419.json;
location /419.json {
internal;
default_type application/json;
return 419 '{ "code": 419, "message":"Insufficient Space on Resource" }';
}
error_page 420 /420.json;
location /420.json {
internal;
default_type application/json;
return 420 '{ "code": 420, "message":"Method Failure" }';
}
error_page 421 /421.json;
location /421.json {
internal;
default_type application/json;
return 421 '{ "code": 421, "message":"Misdirected Request" }';
}
error_page 422 /422.json;
location /422.json {
internal;
default_type application/json;
return 422 '{ "code": 422, "message":"Unprocessable Entity" }';
}
error_page 423 /423.json;
location /423.json {
internal;
default_type application/json;
return 423 '{ "code": 423, "message":"Locked" }';
}
error_page 424 /424.json;
location /424.json {
internal;
default_type application/json;
return 424 '{ "code": 424, "message":"Failed Dependency" }';
}
error_page 428 /428.json;
location /428.json {
internal;
default_type application/json;
return 428 '{ "code": 428, "message":"Precondition Required" }';
}
error_page 429 /429.json;
location /429.json {
internal;
default_type application/json;
return 429 '{ "code": 429, "message":"Too Many Requests" }';
}
error_page 431 /431.json;
location /431.json {
internal;
default_type application/json;
return 431 '{ "code": 431, "message":"Request Header Fields Too Large" }';
}
error_page 451 /451.json;
location /451.json {
internal;
default_type application/json;
return 451 '{ "code": 451, "message":"Unavailable For Legal Reasons" }';
}
error_page 500 /500.json;
location /500.json {
internal;
default_type application/json;
return 500 '{ "code": 500, "message":"Internal Server Error" }';
}
error_page 501 /501.json;
location /501.json {
internal;
default_type application/json;
return 501 '{ "code": 501, "message":"Not Implemented" }';
}
error_page 502 /502.json;
location /502.json {
internal;
default_type application/json;
return 502 '{ "code": 502, "message":"Bad Gateway" }';
}
error_page 503 /503.json;
location /503.json {
internal;
default_type application/json;
return 503 '{ "code": 503, "message":"Service Unavailable" }';
}
error_page 504 /504.json;
location /504.json {
internal;
default_type application/json;
return 504 '{ "code": 504, "message":"Gateway Timeout" }';
}
error_page 505 /505.json;
location /505.json {
internal;
default_type application/json;
return 505 '{ "code": 505, "message":"HTTP Version Not Supported" }';
}
error_page 507 /507.json;
location /507.json {
internal;
default_type application/json;
return 507 '{ "code": 507, "message":"Insufficient Storage" }';
}
error_page 511 /511.json;
location /511.json {
internal;
default_type application/json;
return 511 '{ "code": 511, "message":"Network Authentication Required" }';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment