Yogesh Chauhan's Blog

The difference between 400(4xx) and 500(5xx) errors

in Miscellaneous on February 23, 2020

The main difference between the two is whose fault that error is. A 4xx code indicates an error caused by the user, whereas 5xx codes tell the client that they did everything correctly and it’s the server itself who caused the problem.

When should we return 4xx or 5xx status codes to the client?

4xx codes are used to tell the client that a fault has taken place on THEIR side. They should not retransmit the same request again, but fix the error first.

5xx codes tell the client something happened on the server and their request by itself was perfectly valid. The client can continue and try again with the request without modification.


Most Read

#1 How to check if radio button is checked or not using JavaScript? #2 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #3 How to add Read More Read Less Button using JavaScript? #4 How to uninstall Cocoapods from the Mac OS? #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to Use SQL MAX() Function with Dates?

Recently Posted

#Aug 15 Is PHP still good for back-end programming? #Aug 10 How to create a multisite network in WordPress? #Aug 3 How to create a circle that follows a cursor using JavaScript and CSS? #Aug 3 How to make a curtain slider using jQuery and CSS? #Aug 2 How to progressively load images and add a blurry placeholder? #Aug 1 How to create a placeholder loader (throbber) using CSS?
You might also like these
Optional arguments, Default parameters and REST parameters in JavaScriptJavaScriptThe SQL EXISTS OperatorSQL/MySQLHow to add a ribbon inside a container using CSS?CSSHow to display modal from bottom to top using CSS and JavaScript?CSSHow to add onclick event to html elements dynamically using JavaScript?JavaScriptHow to create a for loop in SCSS (Sass)?SCSSUseful (and probably ignored) HTML tags: Part 2HTMLWhat is the difference between float and double?MiscellaneousFlash of Invisible Text and Mitt Romney Web Font ProblemCSSJavaScript String Properties and MethodsJavaScript@forward rule in SCSS (Sass)SCSSHow to Create a Copy of a Table in SQL and MySQL?SQL/MySQL