为什么会出现HTTP 503服务不可用错误?

huangapple go评论85阅读模式
英文:

Why do we get HTTP 503 service unavailable?

问题

我知道HTTP 503意味着"服务器不可用",如mozilla文档中所述。但是,如果服务器不可用或离线,那么那个服务器怎么能够返回503响应?是客户端超时并假设为503吗?

更新 -
我了解到通常会有"中间人",比如负载均衡器,当后端停止运行时会返回503。那么,如果没有中间人呢?在那种情况下,会得到HTTP 408吗?

英文:

I know that http 503 means that the "server is unavailable" as mentioned in mozilla docs. But, if the server is unavailable or offline, then how is that server able to return a 503 response ? Is the client getting timed out and assuming a 503?

UPDATE -
I learned that there is often "middle man" such as a load balancer which gives the 503 when the backend is down. So, what if there is no middle man? Would you get an http 408 in that case?

PS - Java and Python tags are added only to get more attention from developers who are likely to know the answer to this question.

答案1

得分: 2

"50x"错误是应用程序错误。这意味着如果你有例如Apache2或Nginx Web服务器,并且该服务器与当前不可用(宕机、启动中、冻结等)的后端应用程序通信,你会收到这个503错误。

> 你 -----> Apache2/Nginx Web服务器 ------> 应用程序后端 = 你会得到200
> 响应。

> 你 -----> Apache2/Nginx Web服务器 --XXX--> 应用程序后端 = 你会得到503
> 错误。

英文:

50x errors are for application errors. This means that if you have for example Apache2 or Nginx web server and that server communicate with backend application which is currently unavailable (down, starting, freezed, etc) you get this 503 error.

> YOU -----> Apache2/Nginx web server ------> app backend = you will get 200
> response.

> YOU -----> Apache2/Nginx web server --XXX--> app backend = you will get 503
> error.

huangapple
  • 本文由 发表于 2020年9月11日 00:42:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/63834141.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定