danwrong / restler

REST client library for node.js
MIT License
1.99k stars 391 forks source link

Proxy setting #176

Open YoleYu opened 10 years ago

YoleYu commented 10 years ago

I found that the same code can work at home, not in office.

Finally I find that, it's because the proxy.

Not sure if there is any way to make restler support proxy setting.

rufengl commented 9 years ago

I found that changing line 78 of restler.js to the following can work for proxy:

path: this.options.path || this._fullPath(),

and the pass proxy URL as the baseUrl and added real rest URL to options { path: restUrl, .... }

Could someone add the change to support proxy?

Thanks

mwittig commented 6 years ago

A different approach is to use a http.Agent implementation that connects to a specified HTTP or HTTPS proxy server. The nice thing is that it can be simply passed into restler by setting the "options.agent" property. For a suitable agent implementation which handles, both, http and https see https-proxy-agent.