Skip to content

Instantly share code, notes, and snippets.

@nepsilon
Created November 22, 2016 03:55
Show Gist options
  • Save nepsilon/ceed5b866024729449dcb48894eadc2d to your computer and use it in GitHub Desktop.
Save nepsilon/ceed5b866024729449dcb48894eadc2d to your computer and use it in GitHub Desktop.
Understanding HTTP’s status codes — First published in fullweb.io issue #75

Understanding HTTP’s status codes

Following our series on HTTP, here is a quick note on HTTP status code, sent with the HTTP response. They are organized in 5 categories:

1xx Informational, ex:

  • 100 Continue used when doing a multi-part file upload
  • 101 Switching Protocol used when switching from HTTP to WebSocket

2xx Success, ex:

  • 200 OK all is good the client received the resource
  • 201 Created used mostly with REST API to mean the resource has been created

3xx Redirection, ex:

  • 301 Moved Permanently the redirect to use for SEO so that Google follow/index the link
  • 304 Not Modified meaning the client can use its local cached copy

4xx Client Error, ex:

  • 400 Bad Request the generic bad request response
  • 413 Payload Too Large often means the file uploaded is too big

5xx Server Error, ex:

  • 502 Bad Gateway often means your application server is down
  • 504 Gateway Timeout often means the web/application server took too long to reply

For a simple and exhaustive list, checkout httpstatuses.com. All codes are there with an explanation and code references in various programming languages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment