Issues uploading files to a Python/Django application

We are having issues when it comes to uploading files to a Python/Django application. I believe the source of our issues is due to running things through Mod Proxy.

Taking a basic template:
<form id="uploadfile" action="/upload"
enctype="multipart/form-data" method="post">
{% csrf_token %}
<input name="file" type="file"/>
<input type="submit" name="submit">


When we try to upload data, we will get this error in the Apache error log.

[Wed Apr 13 22:14:22.637130 2016] [proxy:error] [pid 28086] (32)Broken
pipe: [client X:57659] AH01084: pass request body failed to [::1]:3006 (localhost), referer: http://XY/ [Wed Apr 13 22:14:22.637197 2016] [proxy_http:error] [pid 28086] [client X:57659] AH01097: pass request body failed to [::1]:3006 (localhost) from X (), referer: http://XY/

In the runserver.log:
^@^@^@^@^@^@^.....MANY MORE....
Bad request (Unable to parse request body): /upload
[13/Apr/2016 22:09:28] "POST /upload HTTP/1.1" 400 26

The same application works fine on another server using mod wsgi. I've increased all the timeout values, but the there is nothing I can do to fix things. I've added code to the upload method and it never even calls it, returns before any code in the method is called.

Not even a simple upload form works and it's not clear why. Is there any way to remove this proxy balancing stuff and just use mod_wsgi or will that cause issues? Is there another solution?

Your assistance is greatly appreciated.



Howdy -- I've done some research into the issue you're describing, I'm not quite sure of the cause of that error at the moment. I'm hoping that maybe Jamie will have some thoughts, though I'll do some additional digging.

Regarding your other questions -- I don't see them above anymore, so maybe you edited them out, but I'll answer them anyhow just for good measure :-)

This is the best place to post questions as a Virtualmin Pro customer. If you have any questions, feel free to post them here. And if they contain any sensitive information, feel free to select the "Private" option when creating your request.

How large was the final you are trying to upload?

Hi andreychek ,

Thank you for answering those questions. They were edited out since I had opened a new, separate ticket for that issue of not knowing what was happening to the multiple emails sent to sales and the issue with support. I will begin using this system to send those emails and mark the 'private' option when doing so.

The file I was trying to upload in the above example was a little under 1MB large. I have tried other, smaller uploads for testing since getting this reply and still had the same issue.

I noticed in one of our other servers with an older version of Virtualmin FCGID is used to process requests and has no issues but in this latest version there is a reverse proxy setup to send requests to

I look forward to hearing from you and any solutions you may have to this issue.

Django has removed FCGI support in 1.9, It was deprecated in 1.8 .

I think that the best method to run Django with Apache is to use mod_wsgi rather than proxy.

I followed this [link] ( from Django documentation to get it running on my Virtualmin Virtual Server.

I think the script should use this method too.

That doesn't resolve the issue in my case but thank you for the link

Do you all have any suggestions for my case? Thank you

Can you post the code for your Django app that the upload is failing for? I'd like to try reproducing this on my own test system, to see why proxying isn't working.

We were able to get it working by changing to Django 1.9.5. But this doesn't resolve the underlying issue of Virtualmin using and the proxy on a production system. Do you all have plans on using mod_wsgi in the near future? Even when removing it from a customers vhost, Virtualmin adds it back in automatically. Our primary purpose of using this CP is for python/django and the proxy system doesn't work so well in production. Thanks

I was gonna ask the same. I was personally thinking of writing the install script for Django using mod_wsgi soon. But I got to understand the syntax of Perl first. My first time with Perl. Lets see what happens.

wsgi support would be possible, but we decided to go with proxy mode because most of the code needed is already in Virtualmin.

Are there any plans in the future of making it support wsgi? We have the professional version and didn't know if perhaps you all had plans to at least do this for this version. Thanks

It's on the TODO list, but mildly complicated due to the Apache module dependencies.