[This is all you need to remember] A quick review of HTTP status code errors

table of contents
Introduction
Nice to meet you all!
This is my first time writing a blog post. I'm Mikoto from the Systems Solutions Department, a 2024 graduate.
I couldn't think of a nickname, so my mother gave me one.
error codes, which are among the status codes that I've found to be important in my work the 4XX and 5XX I'd like to mainly explain

↑The error code is 401 in the image above!
To explain, we will look at the status codes from sample access logs recorded on the server, but if you are unfamiliar with this, I hope you will just take a quick look at it to understand that this is what we normally look at to analyze access
By the way, if you're interested in access logs, please check these out!
[Apache] Easy explanation of how to view access logs! *Updated 2024
[nginx] Explanation of how to view, configure, and locate access logs.
What is a status code anyway?
A status code isa three-digit number that a web server returns in response to an HTTP request. You can check the status of your request from this number!
You can check it using the developer tools (the developer tools in Chrome), so feel free to take a look.

↑The part in the red frame is the status code!
Status codesInformation Provided (1XX), Success (2XX), Redirection (3XX), Client Error (4XX), and Server Error (5XX). This allows for a clear understanding of whether the access was successful or, if not, what went wrong.
Two types of error codes
4XX - Client Error
Status codes starting with 4 mainly indicate a problem on the client (user) side, and are seen when the server cannot process the request due to an error in the request content or access denial
For example, I often see something like this:
▼400 Bad Request:
127.0.0.1 - - [25/Dec/2023:14:25:00 +0900] "GET /api/data?date=2023-12-33 HTTP/1.1" 400 172 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
This is a 400 error returned because the request format sent by the client was incorrect.
For example, in the example above, the client entered an invalid date (December 23, 2023) for '/api/data', which is why the 400 error occurred.
▼401 Unauthorized:
127.0.0.1 - - [25/Dec/2023:13:15:00 +0900] "POST /login HTTP/1.1" 401 187 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
This error indicates that the client has not provided the correct authentication credentials.
In the example above, a POST request to /login resulted in a 401 error, suggesting that the correct username, password, etc., were not sent.
▼403 Forbidden:
127.0.0.1 - - [25/Dec/2023:13:20:00 +0900] "GET /admin/settings HTTP/1.1" 403 249 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.1 Safari/603.1.30"
"Forbidden" is an English word meaning "prohibited," and as the name suggests, it is an error code that may be displayed when a request is sent to a path that is only accessible to a limited number of users.
In the example error, it can be seen that a client without permission sent a GET request to /admin/settings, but a 403 error was returned.
▼404 Not Found:
127.0.0.1 - - [25/Dec/2023:13:25:00 +0900] "GET /about-us HTTP/1.1" 404 210 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1"
This 404 error can be returned when the server cannot find the requested resource, which can happen for a number of reasons:
- The user mistyped the URL
- The specified page was old and no longer exists
- The correct URL was not set due to a server misconfiguration
- The resource has been temporarily moved or deleted
5XX - Server Error
Status codes starting with 5problem on the server sideindicate a
For example, there are the following:
▼500 Internal Server Error:
127.0.0.1 - - [25/Dec/2023:14:00:00 +0900] "GET /dashboard HTTP/1.1" 500 215 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
This error code is returned when an internal error occurs on the server and the request cannot be processed
If you encounter this error, try reviewing the most recent changes you made to the server settings; this might help you find the cause!
Also, if the error occurred after making some configuration changes, you can often resolve it by reverting to a previous backup!
▼503 Service Unavailable:
127.0.0.1 - - [25/Dec/2023:14:15:00 +0900] "GET /reports HTTP/1.1" 503 212 "-" "Mozilla/5.0 (iPad; CPU OS 13_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Mobile/15E148 Safari/604.1"
The server is temporarily unable to process the request, possibly due to maintenance or overload
For example, if there is a sudden increase in access, the server may not be able to handle it and may return a 503 error!
▼504 Gateway Timeout:
127.0.0.1 - - [25/Dec/2023:14:20:00 +0900] "GET /video/stream HTTP/1.1" 504 160 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36"
This occurs when the server load becomes high due to some factor, causing the gateway/proxy server to exceed its set time limit (timeout value) while waiting for a response from the upstream server. This makes it
difficult to respond to user requests before the time limit expires.
Sometimes, restarting the middleware and temporarily resetting the connection can fix the problem, but to prevent recurrence, it's necessary to investigate the cause of the excessive processing time.
(Extending the timeout value is one possible solution, but I've never seen it work in a real-world scenario...)
Examples of causes include the following:
- It's stuck doing some heavy processing
- Performing large-scale database operations that consume a lot of resources
- There is a network problem
- Something is wrong with the upstream server
Trivia
▼418 I'm a teapot:

Are you familiar with this 418 error?
This status code, defined as an April Fool's joke about 20 years ago,
represents an error where an attempt to pour coffee into a teapot is rejected.
In fact, it is not an HTTP communication status code, but rather exists as a status code for HTCPCP (Hyper Text Coffee Pot Control Protocol) communication, and even the verification tool will show the status as 418
If you're interested,here!
Also, HTCPCP, like 418, is an April Fool's joke, so please look it up!
summary
That concludes our introduction to error codes, which are a type of status code!
Besides these, there are other error codes, such as 499, that are output by specific middleware, so if you're interested, please feel free to look them up!
Now that I'm in my first year as an infrastructure engineer, I encounter status codes quite often, so I recommend studying them if you're interested (although I started without knowing anything about them)
Thank you for watching!
Reference:
[Explanation of commonly seen HTTP status codes] What are HTTP status codes? Detailed explanation by code number
HTTP status code list and detailed guide
HTTP response status codes
What is HTTP status code 418?
8
