I've continued my investigation, and got it working.
The issue happens in the haxe.Http.readHttpResponse function. I get no "content-length" header from the proxy, so the size can't be set before reading the data. So I subsequently get inside the (size == null) case, where the socket is shutdown at first (because noShutdown is set to false), and the data are downloaded until an EOF error is raised by the socket. Here's the logs I get:
Http.hx:535: Trying to read from the socket...
Http.hx:537: Read 1024 bytes
Http.hx:535: Trying to read from the socket...
Http.hx:537: Read 1024 bytes
Http.hx:535: Trying to read from the socket...
Http.hx:537: Read 544 bytes
Http.hx:535: Trying to read from the socket...
Http.hx:546: Encountered an EOF error, stopped reading.
At this point, the data inside the buffer are truncated, and the unserialization fails.
I got it working by setting noShutdown to true. That changes the logs to:
Http.hx:535: Trying to read from the socket...
Http.hx:537: Read 1024 bytes
Http.hx:535: Trying to read from the socket...
Http.hx:537: Read 1024 bytes
Http.hx:535: Trying to read from the socket...
Http.hx:537: Read 544 bytes
Http.hx:535: Trying to read from the socket...
Http.hx:537: Read 1024 bytes
Http.hx:535: Trying to read from the socket...
Http.hx:537: Read 322 bytes
Http.hx:535: Trying to read from the socket...
Http.hx:546: Encountered an EOF error, stopped reading.
And at that point, the data were complete.
It's still hard to be sure that the issue really did came from that part, because the proxy caching tends to be quite random, but apparently, it did the trick. Now, by looking at the HttpConnection class of haxe.remoting, it seems that the noShutdown flag is set when compiled with the "no_remoting_shutdown" flag. Maybe it would be worth setting that flag when a proxy is used? I don't really understand why we'd like to shutdown the socket before having read its input anyway, but there's probably a good reason for that, right?
I hope that helped!