lobe-chat
lobe-chat copied to clipboard
[Question] 使用cloudflare tunnel 部署时无法流式回应
🧐 问题描述 | Proposed Solution
如题,无法在使用 cloudflare tunnel 部署时使用流式回应
📝 补充信息 | Additional Information
No response
👀 @wenwen12345
Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。
看看这个是不是相关问题: https://github.com/lobehub/lobe-chat/discussions/540
oneapi 没有上https 只是 把lobechat暴露了出去
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
oneapi does not go to https, it just exposes lobechat.
与 #540 无关。
参考 https://github.com/cloudflare/cloudflared/issues/199#issuecomment-1660741101
需要加上 text/event-stream
header cloudflare才会no proxy buffer
改写nginx反代:
location /api/openai/chat {
proxy_pass http://your_backend_service;
# 添加或更改响应头
+++ add_header Content-Type text/event-stream;
# 你通常需要关闭缓冲
proxy_buffering off;
#其他配置,如websocketset header 等等,
......
}
kubernetes nginx-ingress示例
kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: lobe-chat-ingress-lsoz4j
namespace: lobe-chat
labels:
app.kubernetes.io/name: lobe-chat
app.kubernetes.io/version: v1
annotations:
nginx.ingress.kubernetes.io/proxy-buffering: 'off'
+++ nginx.ingress.kubernetes.io/configuration-snippet: |
+++ if ($uri ~* "^/api/openai/chat") {
+++ more_set_headers "Content-Type: text/event-stream";
+++ }
...