4

Probably related to How can I use an http proxy with node.js http.Client?

I've read this post, and tried it here. https://gist.github.com/lessmind/5704519

the request function sends a request to specify url, print the request options and page body, when it got a proxy param, it'll parse it and set into the request options as this post said.

But when I tried it on http://showip.net/, the returned ip are the same with proxy or not.

Did I make anything wrong? Or any other way to send a request via proxy?

Community
  • 1
  • 1
nevermind
  • 266
  • 3
  • 12

1 Answers1

3

According to http://nodejs.org/api/http.html#http_http_request_options_callback

hostname: To support url.parse() hostname is preferred over host

Should add this line when overwriting proxy informations.

options.hostname = proxy.hostname;
nevermind
  • 266
  • 3
  • 12