net :: ERR_INCOMPLETE_CHUNKED_ENCODING nginx [英] net::ERR_INCOMPLETE_CHUNKED_ENCODING nginx

查看:4141
本文介绍了net :: ERR_INCOMPLETE_CHUNKED_ENCODING nginx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个RoR Web应用程序托管在2台不同的服务器上。对于一个特定页面,请求由第二个应用程序提供。对于其余页面,请求由主应用程序提供。
主应用程序的Nginx设置

  location / customer / help / {
proxy_pass http://第二应用:3020 / help_and_support /;
}
location / assets / {
proxy_pass http:// second-application:3020 / assets /;
}

直到昨天为止,这工作得很好。现在, / customer / help / 页面无法正常加载。在firefox中,它显示一个空白页面,在Chrome中,它部分加载并且控制台显示错误

  net :: ERR_INCOMPLETE_CHUNKED_ENCODING 

调试结束后,我发现这个问题可能与通过API发送的图像数据有关。我的第二个应用程序调用一个API来获取图像并将其显示在页面上

 <%url_with_binary_data =data:image /+ jpeg+; base64,+ u.photo_url.to_s%> 
<%= image_tag(url_with_binary_data,:class =>userpic)%>

获取图片的API代码

  photo_url:Base64.encode64(u.photo.file.read).gsub(\\\
,'')


解决方案

您可能需要检查运行Nginx worker的用户是否拥有目录 / var / LIB / nginx的

我了解到,如果您对Nginx的响应太大,它会使用此目录作为临时文件的工作目录。如果工作进程无法访问它,Nginx将在其完成之前终止传输,从而导致错误INCOMPLETE_CHUNKED_ENCODING。


I have 2 RoR web applications hosted on 2 different servers. For one particular page, the request is served from the second application. For rest of the pages, the request is served from the main application. Nginx settings for the main application

location /customer/help/ {
            proxy_pass http://second-application:3020/help_and_support/;
}
location /assets/ {
            proxy_pass http://second-application:3020/assets/;
}

This worked fine until yesterday. Now, /customer/help/ page is not loading properly. In firefox it shows a blank page, in chrome, it loads partially and console shows an error

net::ERR_INCOMPLETE_CHUNKED_ENCODING

After debugging I found that issue might be with image data sent over API. My second app calls an API to get images and displays them on page

<% url_with_binary_data = "data:image/" + "jpeg" + ";base64," + u.photo_url.to_s %>
<%= image_tag(url_with_binary_data, :class => "userpic")  %>

API code to get the image

photo_url: Base64.encode64(u.photo.file.read).gsub("\n", '')

解决方案

You might want to check if the user that is running the Nginx worker owns the directory /var/lib/nginx.

I've learned that when you give a response too big for Nginx, it uses this directory to write as a working directory for temporary files. If the worker process cannot access it, Nginx will terminate the transmission before it completes, thus the error INCOMPLETE_CHUNKED_ENCODING.

这篇关于net :: ERR_INCOMPLETE_CHUNKED_ENCODING nginx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆