问题描述
我正在使用带有码头机器人servlet的nginx实现.
I am using an implemention of nginx with jetty servlets.
就我的项目而言,我需要初始化两个与码头小服务程序的连接,并使它们保持打开状态.为了初始化下行链路,我使用了正常的请求,并返回了输入流.为了初始化上行链路,我使用了分块的编码请求.
For the purpose of my project I need to initialize two connection to the jetty servlet and keep them open.To initialize the downlink I use a normal request and I get the inputstream back.To initialize the uplink I use a chunked encoding request.
我使用的是1.4.6 Nginx版本,因此无论我在服务器定义中进行设置,均应默认设置分块编码.
I use a 1.4.6 nginx version so the chunked encoding should be set by default, regardless I set it in my server definition.
#HTTPS server
server {
listen 443;
listen [::]:443;
server_name localhost;
ssl on;
ssl_certificate /etc/nginx/ssl/server.crt;
ssl_certificate_key /etc/nginx/ssl/server.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_http_version 1.1;
expires off;
proxy_buffering off;
chunked_transfer_encoding on;
proxy_pass https://127.0.0.1:8080;
# root html;
# index index.html index.htm;
}
}
我已经搜索了所有论坛,但仍然找不到解决方案.启用分块编码,代理缓冲关闭等.我无法正常工作.我还进行了简单的测试,以确保不是我的应用程序实现以某种方式阻止了它,但仍然无法正常工作.
I've searched through all the forums and I still can't come across a solution.Enabled chunked encoding, proxy buffering off etc etc.I can't get it to work. I have also done simple tests to make that it's not my apps implementation that's blocking it somehow and it still doesn't work.
还有什么可以尝试的吗?
Anything else I can try?
推荐答案
所以我也在nginx论坛上发了帖,并得到了回复.我专门在寻找的东西叫做无缓冲上传",这是nginx目前不提供的功能.
So I also posted on the nginx forum and I got a reply. The thing I am specifically looking for is called "unbuffered upload" and that is currently a feature that nginx does not provide.
使用websocket是不可能的,因为以后需要在使用http协议的更大,更旧的系统中实现此原型.因此,答案是"nginx"不可能.对于面临相同问题的任何人,可能的解决方法是使用tengine这是nginx分支.
Using websockets is out of the question because later this prototype will need to be implement in a bigger and older system that uses the http protocol. So the answer for this would be it's not possible with "nginx". A possible work around for anyone facing the same issue is using tengine which is an nginx fork.
这篇关于nginx分块传输编码失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!