Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apollo接口报504 #171

Open
ClementeGao opened this issue Sep 28, 2021 · 4 comments
Open

Apollo接口报504 #171

ClementeGao opened this issue Sep 28, 2021 · 4 comments

Comments

@ClementeGao
Copy link

image
上图的错误,请假下大佬 是什么原因引起的?

@Anilople
Copy link
Contributor

参考 504 Gateway Timeout https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Status/504

是不是中间经过了一层代理?

@ClementeGao
Copy link
Author

@Anilople 应该是有nginx

@Anilople
Copy link
Contributor

@zdan
Copy link

zdan commented Feb 21, 2024

今天检查nginx-ingress日志时,也遇到类似的504请求,在configMap中增加如下参数可以解决问题:

// proxy-read-timeout 用于设置从上游服务器读取响应的超时时间。默认值为60秒。nginx参数为:proxy_read_timeout
proxy-read-timeout: 65

之所以在60秒以后出现504,与apollo长连接的实现逻辑有关:

  1. /notifications/v2发起请求以后,如果配置有变更,则实时响应请求;
  2. 如果配置无变更,则apollo默认会等待60秒,期间如无配置变更,在60秒后响应304状态码;
  3. 但是nginx配置默认读取上游服务响应体的超时时间是60秒,超时则中断连接并响应504状态码。

也就是说,只要把读取响应体的超时时间设置为大于60秒可以规避该问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants