净::ERR_INCOMPLETE_CHUNKED_ENCODING Nginx [英] net::ERR_INCOMPLETE_CHUNKED_ENCODING nginx

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

问题描述

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

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/;
}

直到昨天这一切都很好.现在,/customer/help/ 页面没有正确加载.在 Firefox 中,它显示一个空白页面,在 chrome 中,它部分加载并且控制台显示错误

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

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

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代码

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

推荐答案

您可能想检查运行 Nginx worker 的用户是否拥有目录 /var/lib/nginx(或 /var/cache/nginx 在某些发行版中).

You might want to check if the user that is running the Nginx worker owns the directory /var/lib/nginx (or /var/cache/nginx in some distros).

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

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.

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

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