代理或网关如何处理上游状态代码?

时间:2016-08-23 12:26:14

标签: http proxy http-status-codes gateway

现在我们正在编写一个网关服务器,它接收来自客户端的请求,修改它并将修改后的请求发送到上游,然后将响应复制回客户端。

这里我们提出一个问题,如果上游返回HTTP状态代码500,我们应该将500返回给客户端吗?如果是这样,我们如何区分网关是否失败或上游失败?

类似的问题也适用于HTTP状态代码404,429等...

所以,问题是:

1. Should gateway return HTTP status code as whatever upstream returns?  
   In this case, how do we distinguish which server failed exactly  
   (consider that in a monitor system)

2. Is it a good practice that gateway map upstream status codes to some  
   fixed range of status codes? e.g. upstream 5xx -> client 502

0 个答案:

没有答案