gpt4 book ai didi

html - 服务器通过 Varnish 代理发送的事件

转载 作者:太空宇宙 更新时间:2023-11-04 15:18:19 26 4
gpt4 key购买 nike

我有一个在 Varnish 代理后面运行的网站。为服务器发送的事件打开的任何连接都不会获取任何内容,也不会关闭。 Varnish 似乎在将内容转发到浏览器之前等待内容流结束。并且它保持与服务器的连接打开,直到内容结束。这两个问题都与服务器发送的事件不兼容。

我如何配置 Varnish 以立即将内容刷新到浏览器并在浏览器关闭其连接时关闭其与服务器的连接?

或者我可以动态地指示 Varnish 完全充当连接的传递 channel ,就好像它根本不存在一样?我可以毫无问题地在非代理系统上运行完全相同的 Web 应用程序。而且我无法在此设置中完全绕过 Varnish(例如,不同的端口)。

最佳答案

你试过在 vcl_recv 中返回 pipe 吗?

来自documentation :

Pipe can be returned from vcl_recv as well. Pipe short circuits the client and the backend connections and Varnish will just sit there and shuffle bytes back and forth. Varnish will not look at the data being send back and forth - so your logs will be incomplete. Beware that with HTTP 1.1 a client can send several requests on the same connection and so you should instruct Varnish to add a "Connection: close" header before actually returning pipe.

不要错过,您必须仅为 SSE 传入请求返回 pipe

关于html - 服务器通过 Varnish 代理发送的事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12308923/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com