-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse Error when using REST client behind proxy #16
Comments
Hi First of all many thanks for your support words, they're very kind ;) I think I've an easy solution to your problem and most important - at least to me - that won't break compatibility with previous node-rest-client versions. I'll try to apply it in the next few days (probably on next monday it will be ready), keep an eye. |
Hi as you can see it has not been fixed "on next monday".... :( I'll try to fix it asap sorry for the delay. |
No need to sorry, thanks :) |
I'm already fixing the issue, but of course you can do a pull request whenever you want. Surely it will help me. just one question, the request that works and you mention in your previous comment was done directly with http client for node.js and not using node-rest-client? Thanks |
Well I think I've fix it. As you can see in the new version of the docs there's a new parameter in proxy options "tunnel:true | false". So if you want to use direct request to proxy instead of tunneling you must instantiate the client with "tunnel:false" (to maintain backward compatibility I couldn't set direct request to proxy as default proxy connection method) var RestClient = require('node-rest-client').Client,
client = new RestClient({
proxy:{
host:"proxyDomain",
port: 8080,
user:"username",
password:"password",
tunnel:false // use direct request to proxy
}
});
client.registerMethod("jsonMethod", "http://ogcef.one.gov.hk/event-psi/json/calendar/20140215.json", "GET");
client.methods.jsonMethod(function (data, response) {...}); I've tested and for me it's working, please let me know whether it works for you too. |
Thanks. It works like a charm. :) Would you please release it to NPM repository also? Thanks a lot. |
That's what I'm trying since yesterday, but I'm having unexpected authentication problems with npm registry (?!??). Hope that it'll be fixed soon |
I've had to reinstall node and npm and now everything seems to work again, but please if you don't mind let me know whether it works for you. Thanks. |
Hey guys, thanks so much for this module - it's made my first forray into Node a lot easier. But, I was running 0.7.7 and I happened to be combining projects and ran npm install in a new directory, and got version 0.7.9 (had "node-rest-client" : "~0.7.7"), and I noticed the commit associated with this issue. And I got this error:
I reverted to 0.7.7 and it worked. server.js:39 is:
routes.js:10 is the client = line below:
Hopefully this is helpful. Thanks. |
Yes, direct proxy connection works for me. Thanks. |
Hello @aacerox , I have the client response as follows after the set up
I am using Charles for proxy settings. Please let me know what am I doing wrong. |
Hi,
I have experienced an error throwing from Socket.socketOnData method when calling REST client behind a proxy. Here is the code I used:
After checking up the REST client code a bit, I found that it will try to connect to proxy via 'CONNECT' method using Node.js http client and then making another connection after this call returned successfully. The issue is that if you use Node.js http client to trigger a call using 'CONNECT' method, the above exception is thrown.
May I suggest to use something similiar below so that REST client can connect to the target URL successfully behind a proxy environment? I have tested in my local and it works:
Is it possible to change ConnectManager.proxy function to use the approach above instead of making a CONNECT call?
Thanks and this package is an awesome package for Node.js :)
Sincerely,
Jason
The text was updated successfully, but these errors were encountered: