使用GAE flexible环境运行docker映像时阻止了服务器发送的事件 [英] Server-sent events blocked when using GAE flexible environment to run docker images

查看:62
本文介绍了使用GAE flexible环境运行docker映像时阻止了服务器发送的事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在本地访问服务器发送的事件端点时,它可以正常工作并且每两秒钟吐出数据;当我SSH进入appengine vm时,它也可以正常工作(使用curl),但是当我尝试访问服务器端时来自外部appengine的事件终结点,我只是超时.GAE是否阻止了服务器端事件?我看到websocket可能很麻烦,但是服务器端事件是通过http进行的.

When I try to access server-sent events endpoint locally it works fine and spits out data every two seconds, when I ssh into the appengine vm it also works fine (using curl) but when I try and access the server-side events endpoint from outside appengine I just get timeouts. Is server-side events blocked in GAE? I see that websocket could be troublesome, but server-side events are over http.

推荐答案

否,在Google App Engine中不会阻止服务器发送的事件.但是由于默认情况下GAE启用了缓冲,因此由于请求永远不会完成,它们将永远不会到达您.在您的SSE响应中禁用带有此标头的缓冲:

No, server-sent events are not blocked in Google App Engine. But since GAE have buffering enabled by default they will never reach you since the request never completes. Disable buffering with this header in your SSE response:

X-Accel-Buffering: no

在此处了解更多信息:如何处理请求

Read more here: How Requests are Handled

这篇关于使用GAE flexible环境运行docker映像时阻止了服务器发送的事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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