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

[Question] 使用Nginx做代理自定义域名后,无法实现流式回答 #754

Closed
syusama opened this issue Dec 22, 2023 · 6 comments
Closed
Labels
😇 Help Wanted Need help | 需要帮助

Comments

@syusama
Copy link

syusama commented Dec 22, 2023

🧐 问题描述 | Proposed Solution

部署在服务器上后,如果使用ip:port访问,可以正常流式回答(打字机效果),但是配置NGINX自定义域名之后,就没有打字机效果了,会等待很长一段时间然后返回回答

📝 补充信息 | Additional Information

NGINX配置如下:
server {
server_name baize2.xxxxx.com;
location / {
client_max_body_size 64m;
proxy_http_version 1.1;
proxy_pass http://localhost:3210;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header Accept-Encoding gzip;
proxy_read_timeout 300s;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host:$server_port;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_max_temp_file_size 0;
proxy_redirect off;
proxy_set_header X-Real-PORT $remote_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/baize2.scdipt.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/baize2.scdipt.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

server {
if ($host = baize2.xxxxxx.com) {
    return 301 https://$host$request_uri;
} # managed by Certbot


	listen 80;
	server_name baize2.scdipt.com;
return 404; # managed by Certbot

}}

@syusama syusama added the 😇 Help Wanted Need help | 需要帮助 label Dec 22, 2023
@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


🧐 Problem Description | Proposed Solution

After deployed on the server, if you use ip:port to access, you can stream the answer normally (typewriter effect). However, after configuring the NGINX custom domain name, there is no typewriter effect, and the answer will be returned after waiting for a long time.

📝 Additional Information |

NGINX configuration is as follows:
server {
server_namebaize2.xxxxx.com;
location/{
client_max_body_size 64m;
proxy_http_version 1.1;
proxy_pass http://localhost:3210;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header Accept-Encoding gzip;
proxy_read_timeout 300s;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host:$server_port;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_max_temp_file_size 0;
proxy_redirect off;
proxy_set_header X-Real-PORT $remote_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/baize2.scdipt.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/baize2.scdipt.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

server {
if ($host = baize2.xxxxxx.com) {
return 301 https://$host$request_uri;
} # managed by Certbot

listen 80;
server_namebaize2.scdipt.com;
return 404; # managed by Certbot

}}

@lobehubbot
Copy link
Member

👀 @syusama

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。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

@arvinxx
Copy link
Contributor

arvinxx commented Dec 22, 2023

试试 #531

@syusama
Copy link
Author

syusama commented Dec 22, 2023

试试 #531

感谢大佬,可以了!!!!

@syusama syusama closed this as completed Dec 22, 2023
@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Try #531

Thanks man, it’s ok! ! ! !

@lobehubbot
Copy link
Member

@syusama

This issue is closed, If you have any questions, you can comment and reply.
此问题已经关闭。如果您有任何问题,可以留言并回复。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
😇 Help Wanted Need help | 需要帮助
Projects
None yet
Development

No branches or pull requests

3 participants