Rails “Clip Clips” POSTing instead of PUTting when loading a .zip file

I have a form (Rails 3.2.8, Paperclip 3.1.4) with two clip attachments for a model with two has_attached_files. One of them is for an image, and the other is for a shared file, usually a .zip file.

Everything works fine until I try to upload a zip file. Downloading a .zip file of any size (the original was 80 MB, but tried 3 MB to find out if there was a problem with the size) causes the POST form instead of PUT, and Rails causes a routing error.

The form method is POST, but it has the hidden value of the Rails method, set to "put", which works fine and calls PUT when I am not trying to load .zip files.

The form actually has the "multipart" enctype bit set.

Any idea what could be causing this?

+7
source share
1 answer

The file sounds a lot. Double check that the actual parameters contribute it to the request. I get this locally as well as depending on the size of the files.

The effect that I saw is that the rails will basically not have any parameters. Since PUT is actually a message with a hidden element, the rails will only see POST, since the parameters are discarded.

I'm really not sure what causes this. I think it could be a local web server, so you might need to configure nginx or something else. This never happens to me on a hero or something else, but always on local if the file is big enough.

Also note that webrick has a really very small request payload size limit. Therefore, do not use this. Use thin as it is a really easy replacement.

+1
source

All Articles