I'm trying to GET request a URL using a SOCKS connection to the Private Internet Access proxy server, but getting this error:
Error: SOCKS connection failed. Connection not allowed by ruleset.
from the socks5-http-client
npm package.
My code:
var request = require('request')
var Agent = require('socks5-http-client/lib/Agent')
var options = {
url: url,
agentClass: Agent,
agentOptions: {
socksHost: 'proxy-nl.privateinternetaccess.com',
socksPort: 1080,
socksUsername: 'USERNAME',
socksPassword: 'PASSWORD'
}
}
request(options, function (error, res, html) {
if (!error && res.statusCode == 200) {
}else {
logging.error(error)
}
})
An HTTPS SOCKS connection was required (nothing in error message about this).
It worked to use this library instead:
socks5-https-client/lib/Agent