[#896] Apply ressource proxy fixes for chunked responses to 2.0

See #896

This pr is slightly different from the original code as it just applies the fixes to the proxy code but not the other changes. It's probably worth reviewing before merging. I tested it with my examples and it seems to work as the version for 2.1.