getting this net::ERR_EMPTY_RESPONSE error in browser

烈酒焚心 提交于 2021-02-19 07:36:45

问题


I used gem "paperclip" for upload images and gem "paperclip-storage-ftp" for store images on my own ftp server.I got success to upload multiple photos and it's saved in my database too without having error.

but when I go to show photos page there i can see some photos proper, But

some most of photos are broken, and i am getting so many error in browser console like this

Failed to load resource: net::ERR_EMPTY_RESPONSE

help me if you have any solution for this.

Thank you.


回答1:


Process Your Images Asynchronously

The Problem

I had the same thing happening to me. I found out that uploading large files were not the issue, it was the processing of the files after the upload by Paperclip that was the problem.

The browser has no problem keeping the connecting alive when it is actively uploading (or downloading) a file, but Paperclip was taking too long to process the files after they were uploaded, which the browser interprets as nothing happening. So if that processing takes too long (~1 min) the browser thinks something went wrong and returns an ERR_EMPTY_RESPONSE.

The Solution

I installed and implemented the wonderful delayed_paperclip gem, which pushes all the Paperclip processing to asynchronous tasks.

This means that once the files are uploaded, the request is completed and the browser gets an immediate response instead of waiting for Paperclip to process the files.

Problem solved.



来源:https://stackoverflow.com/questions/33560288/getting-this-neterr-empty-response-error-in-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!