Closed terrywh closed 12 years ago
The server you're trying to proxy to might be expecting certain headers that aren't being passed through - or it might be rejecting requests that have obviously been proxied.
node-http-proxy
sets the x-forwarded-*
headers, and your connections may be getting refused because of this.
@wuhaocn2008 are you still having an issue with this?
it seems the latter url is ok right now, but the first url is still having some kind of issue when i use the proxy server on CHROME to visit. It keeps loading for a very long time.
I think the problem is the query part of the URL. I'm going to work on getting rid of the hanging problems in node-http-proxy
, I think that's the source of a lot of people's problems. Clear error messages are far more useful than hanging.
It sounds like it was hanging - I just added a pull request to give reasonable errors instead of just hanging. See nodejitsu/node-http-proxy#216. After that pull request is merged in and a new version is up on npm, can you try it again and tell me what error it gives you (if any)?
USE proxyError to track the errors, here is what i got when proxy the first url:
{ [Error: socket hang up] code: 'ECONNRESET' }
it seems you are right about the x-forwarded-for thing. when i proxy some url, it will emit that reset error. For the specific url on top, the reason might be that there should not be a header "x-forwarded" or the server will close the connection.
Thank you for all your trouble.
I try to proxy a request to http://ptlogin2.qq.com/jump?ptlang=2052&clientuin=304290615&clientkey=0D399336F7C4F553C468779FC21FEC92B77EEE1F3D766C61BC3F3B19AD65E070&u1=http%3A%2F%2Fuser.qzone.qq.com%2F573692919 which actually send a "302 Found" status code, but the proxy failed to send any response which cause Chrome showing an "ERR_EMPTY_RESPONSE" error page.
i found visit that url cause proxyError, and i add some code found it to be "error: { [Error: socket hang up] code: 'ECONNRESET' }"
and i get the similar error when proxy to url http://stats.sports.qq.com/NBAImages/TeamImages/Bulls-1.png
my source code: