如何解决504网关超时错误? [英] What can I do to fix a 504 gateway timeout error?

查看:1050
本文介绍了如何解决504网关超时错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用jquery尝试从API中提取数据.但是我收到504错误.即使当我使用邮递员测试数据时,也会发生这种情况.谁能建议我需要做些什么来解决这个问题?

I have been using jquery to try and pull data from an API. However I am getting a 504 error. Even when I am using postman to test the data this happens. Can anyone suggest what I need to do to get around this?

推荐答案

无能为力.

您正在向服务器发送请求.此特定请求失败,因为服务器将请求发送到代理,并收到超时错误.您的服务器将状态报告回给您504.

You are sending a request to a server. This particular request fails, because the server sends a request to a proxy, and gets a timeout error. Your server reports this back to you as status 504.

修复它的唯一方法是修复代理(使其及时响应),或者更改服务器以不依赖该代理.两者都在您的区域之外.

The only way to fix it is to fix the proxy (make it respond in a timely manner), or to change the server to not rely on that proxy. Both are outside your area.

您无法防止此类错误.您可以做的是找出发生此类问题时应该获得的用户体验,并加以实施.顺便提一句.如果您收到504错误,那么您也应该期待超时错误.假设您以60秒的超时向服务器发出请求,而服务器以60秒的超时向代理发出请求.因为两个超时都相同,所以有时您的服务器将收到代理超时并将其发送给您(状态504),但是有时您对服务器的请求将在此之前超时,并且您会收到超时错误.

You cannot prevent such errors. What you can do is find out what user experience there should be when such a problem happens, and implement it. BTW. If you get 504 errors, then you should also expect timeout errors. Say you make a request to your server with 60 second timeout, and your server makes a request to the proxy with 60 second timeout. Because both timeouts are the same, sometimes your server will receive the proxy timeout and send it to you (status 504), but sometimes your request to the server will time out just before that, and you get a timeout error.

这篇关于如何解决504网关超时错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆