TooTallNate / superagent-proxy

`Request#proxy(uri)` superagent extension
154 stars 45 forks source link

http proxy - https endpoint pass, http endpoint fail #3

Closed jarvisaoieong closed 10 years ago

jarvisaoieong commented 10 years ago

I have run it in the actual code and the mocha test. All http endpoint powered by http proxy fail.

TooTallNate commented 10 years ago

Do you have an example script that fails?

jarvisaoieong commented 10 years ago
$ HTTP_PROXY="http://41.207.106.5:3128" npm test

> superagent-proxy@0.0.2 test /Users/jarvis/Sites/superagent-proxy
> mocha --reporter spec

  superagent-proxy
    http: - HTTP proxy
      1) should work against an HTTP endpoint
      ✓ should work against an HTTPS endpoint (5450ms)
jarvisaoieong commented 10 years ago

console.log the res.text, it get ....

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>ERROR: Gateway Timeout</title>
</head>

<body>
    <h2>ERROR: Gateway Timeout</h2>
    <hr noshade size="1px" />
    <p>While trying to retrieve the URL <a href="http://jsonip.com/">http://jsonip.com/</a>:</p>
    <ul>
        <li>
            <strong>Connection refused</strong>
        </li>
    </ul>
    <p>Your cache administrator is <a href="mailto:webmaster">webmaster</a>.
        <br clear="all" />
        <hr noshade size="1px" />
        <address>Generated Tue, 13 Jan 1970 02:39:37 GMT by 41.207.116.219 (Mikrotik HttpProxy)</address></body>

</html>

I have tried many proxy, they have similar error page with http proxy.

TooTallNate commented 10 years ago

@kinua Thanks for the report. I did indeed find a bug in the http-proxy-agent module logic which has now been fixed in v0.2.2 of that module. Please run npm update to have superagent-proxy pick up the updated version. Cheers!