In working on my custom WebDAV server, I discovered an interesting note about the OSX built-in WebDAV client. First of all, if you use finder to copy files (instead of cp in terminal), it sends all files over in chunked transfer-encoding. This is entirely allowed within the WebDAV specification, but it doesn't help that they also send it using the WRONG header. They send the encoding method as "Chunked" instead of "chunked".
While working with Python Paste, I found that chunked encoding wasn't supported at all, so I switched over to using CherryPy. After testing locally and getting everything to work (CherryPy apparently ignores case), I deployed this system to production behind an apache server to add in SSL support (Yes, I plan to use Nginx in the future, but we have apache set up here already). After setting up the proxy, I noticed that I could no longer send files to my WebDAV server and a strange message was appearing in the apache error.log:
[error] proxy: Chunked Transfer-Encoding is not supported
[error] [client xxx.xxx.xxx.xxx] Handler for proxy-server returned invalid result code 22
After a lot of googling, I found a single page (written in german), which describes the issue:
The end result was that I had to enable mod_headers, and place this line in my apache config under the virtual host:
RequestHeader edit Transfer-Encoding Chunked chunked early
This fixes the header before mod_proxy gets to it and changes the "Chunked" to "chunked" which tells apache how to handle the request body.
Comments