When proxying HTTPS to HTTP, I am getting a lot of ERR_CONTENT_LENGTH_MISMATCH errors in Chrome. For example, if I request an image from the web server through the HTTPS proxy, I get a content length of 50KB but the downloaded image is 30KB (and the image appears to be half-downloaded). This is true for _any_ HTTPS request, not just images. This is also true for _any_ web browser. I am testing in a Windows environment with a fairly slow Internet connection.
Perhaps the connection is ending prematurely? Any thoughts on this?
@bminer hmm interesting, is there anyway you could add a minimal failing test that reproduces this? That would be the easiest way to see where the potential bug might be.
@jcrugzz Sure. I'll try to post back here by Thurs. next week.
@bminer was this able to be resolved?
I don't know yet. I am running Node v0.10.15, but I will try 0.10.26 to see if the problem has been fixed.
@bminer its safe to say you should be able to upgrade to v0.10.28 without any problem. Let me know.
@bminer Has your problem gone away since upgrading to 0.10.26? I started seeing this on straight http (no https). If I serve a web page straight from node.js its fine, but if I put it in front of hipache (which uses node-http-proxy) I start getting these ERR_CONTENT_LENGTH_MISMATCH errors for some of my assets. I originally experienced this on 0.10.25, but upgrading to both 0.10.26 and 0.10.28 didn't fix the issue.
@jkingyens if you can get a small reproducible example using the latest version of node-http-proxy, I would love to help figure out why might be happening! Failing tests are always a good addition to find a subtle problem :)
@jcrugzz Understandable :) I couldn't isolate it to node-http-proxy. The best I could do was show the problem occurred behind hipache. Without hipache everything was fine. I was using an older version of hipache so I decided to try the latest release and the problem disappeared. But thanks anyway :)
FYI net::ERR_CONTENT_LENGTH_MISMATCH and net::ERR_INCOMPLETE_CHUNKED_ENCODING may happen on Node 0.11.13 now. Node 0.11.10 works fine.
Using globalAgent seems to solve this issue for me :
var http = require('http');
var httpProxy = require('http-proxy');
var proxy = httpProxy.createProxyServer({
target : "http://mytarget/",
agent: http.globalAgent
});
Had this problem, too. Upgrading from Node v0.10.8 to v0.10.30 resolved it.
from Node v0.10.8 to v0.10.30
from Node v0.10.8
v0.10.8
I hope you are kidding. ;) 0.10.8 was more than a year old.
I think this issue should be closed. I am also no longer experiencing this problem.
Most helpful comment
Using globalAgent seems to solve this issue for me :