[Operation and Maintenance Interview] Interviewer: How much do you know about http status codes?

Preface

This is another sub-question. Many friends always feel that they know little. In fact, the knowledge is there. Even if you work for three years and don’t study, you still don’t know.
Work experience requires more observation and learning, not just because of work experience.

http status code classification

100-199 information prompt status code

Indicates processing

200-299 indicates success status code

200 OK: The request sent from the client is processed normally on the server, and the body of the entity contains the requested resource.
204 No Content: This status code indicates that the request received by the server has been processed, but the server does not need to return the response body.

300-399 redirect

Tell the client to use the alternate location to access the resource they are interested in, or provide an alternate response instead of the resource content. If the resource has been removed, you can tell the customer that the resource has been removed and where you need to jump to where you can find it.

301 Moved Permanently: Permanently redirect.

302 Found: Temporary redirection.

400-499 client error

The 4XX response indicates that the client is the cause of the error. But many 4xx errors are resolved by browsers, so users often see 404s.

  • 400 Syntax error in client request
  • 403 This status code indicates that access to the requested resource was denied by the server.
  • 404 Not Found: indicates that the requested resource cannot be found on the server. Generally, it also contains an entity (such as a 404 page) for the client to show to the user.

500-599 server error

  • 500 Internal Server Error: This status code indicates that the server encountered an error that prevented it from serving the request when executing the request. It may also be a bug in the web application or some temporary failure.
  • 501 Not Implemented: The request initiated by the client is beyond the capability of the server (for example, a request method not supported by the server is used)
  • 502 Bad Gateway: The server has forgotten the gateway error
  • 503 Service Unavailable: This status code indicates that the server is temporarily overloaded or is shutting down for maintenance, and the request cannot be processed now
  • 504 Gateway Timeout: Similar to 408, except that the response here comes from a gateway or proxy, and they have timed out waiting for another server to respond to the alignment request.

How to answer

To answer these kinds of questions, you only need to come up with a few examples. Of course, what the interviewer wants more is your idea of ​​solving the problem.

For example:
Example 1:
There are many status codes for http, 4XX means client error, 5XX means server error, like last time I encountered a 5xx error, and the server reported 500. In general, the service should be checked first. The process is still there, and then check the log, service log, access log, system log, from these logs to find possible clues to the problem

But that time I checked the background process, server configuration, database, everything was normal, and using IP access can access the background, and also get data, only the domain name does not work. Later, I checked the domain name and found that the service domain name was missing. The front desk called this service through the domain name, so a 500 error occurred.

Example 2:
After exiting from the homepage of our website, the interface returned according to the process is the interface that was originally logged in, but once after logging out, it returned a 500 error, so check the tomcat input parameters and check the URL link address corresponding to log out. After changing to the correct address, the problem was solved

to sum up

The most important thing in the interview is actually the ability and ideas to solve the problem, so don't just answer the 5XX server error coldly, but give an example to talk about your own problem-solving ideas.

Guess you like

Origin blog.csdn.net/xinshuzhan/article/details/108544822