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 Solution to the error “Visual Studio Code can’t be opened because Apple cannot check it for malicious software” #2 How to add Read More Read Less Button using JavaScript? #3 How to check if radio button is checked or not using JavaScript? #4 Solution to “TypeError: ‘x’ is not iterable” in Angular 9 #5 PHP Login System using PDO Part 1: Create User Registration Page #6 How to uninstall Cocoapods from the Mac OS?

Recently Posted

#Apr 8 JSON.stringify() in JavaScript #Apr 7 Middleware in NextJS #Jan 17 4 advanced ways to search Colleague #Jan 16 Colleague UI Basics: The Search Area #Jan 16 Colleague UI Basics: The Context Area #Jan 16 Colleague UI Basics: Accessing the user interface
You might also like these
How to compile and watch Sass using Gulp in WordPress?SCSSHow to add Google Static Map using ACF map field?WordPressWordPress: How to add a Search Icon in Menus with toggle effect using jQuery?jQueryHow to disable the Recovery Mode in WordPress?WordPressWindow setTimeout() Method in JavaScriptJavaScriptHow to load variables, functions, and mixins from another module in SCSS?SCSSWordPress: How to access first and random row values from a repeater field in ACF?WordPressGap in Flex?CSSThe unique operator($) in Envision BasicEnvision BasicHow to change the style for checked radio button or checkboxes using CSS?CSSHow to install Gulp with WordPress?WordPressHow to invalidate all existing cookies using Security Keys in WordPress?WordPress