I am trying to make a simple request using http.get. But I need to make this request through the Squid proxy. Here is my code:
var http = require('http'); var username = 'username'; var password = 'password'; var host = "proxy_host"; var auth = 'Basic ' + new Buffer(username + ':' + password).toString('base64'); var options = { host: host, port: 3128, path: "http://www.google.com", authorization: auth, headers: { Host: 'www.google.com' } }; var req = http.request(options, function(res) { console.log('STATUS: ' + res.statusCode); console.log('HEADERS: ' + JSON.stringify(res.headers)); }); req.end();
My username and password are correct according to the ops command that configured the proxy server. The problem is that I continue to receive the status of the required permission 407.
Is there something wrong with the way I make the request? Or do you need to configure a Squid proxy?
Thanks in advance.
source share