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

本地nginx代理后没有流式输出效果 #128

Open
1 task
TheLastManT1 opened this issue Dec 31, 2023 · 1 comment
Open
1 task

本地nginx代理后没有流式输出效果 #128

TheLastManT1 opened this issue Dec 31, 2023 · 1 comment

Comments

@TheLastManT1
Copy link

What operating system are you using?

openwrt

What browser are you using?

chrome

Describe the bug

本地nginx代理后没有流式输出效果。正常情况下一个长回答会逐渐输出,但是代理后就没有这个效果了,变成了等待AI回答完再一下输出全部内容
代理配置
server {#gemini
listen 9105 ssl;
listen [::]:9105 ssl;
server_name xxxx;

ssl_certificate /etc/nginx/conf.d/_lan.crt;
ssl_certificate_key /etc/nginx/conf.d/_lan.key;
# 指定密码为openssl支持的格式
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_prefer_server_ciphers on;  #依赖SSLv3和TLSv1协议的服务器密码将优先于客户端密码
location / {
    proxy_pass http://192.168.1.1:9004/;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Via "nginx";
}

}

What prompt did you enter?

Console Logs

Participation

  • I am willing to submit a pull request for this issue.
@tjsky
Copy link

tjsky commented Jan 9, 2024

在反代配置里设定proxy_buffering off; 禁用 Nginx 的请求缓冲功能。

以你的配置为例

server {#gemini
listen 9105 ssl;
listen [::]:9105 ssl;
server_name xxxx;

ssl_certificate /etc/nginx/conf.d/_lan.crt;
ssl_certificate_key /etc/nginx/conf.d/_lan.key;
# 指定密码为openssl支持的格式
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_prefer_server_ciphers on;  #依赖SSLv3和TLSv1协议的服务器密码将优先于客户端密码
location / {
    proxy_pass http://192.168.1.1:9004/;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Via "nginx";
    proxy_buffering off;  #禁用 Nginx 的请求缓冲功能
}
}

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

2 participants