Calling behind a proxy

Hi Everyone

I am looking to call infura from behind a proxy but not able to do so. Web3 httpprovider does not allow me to use socket object received in response. Please assist

const http = require(‘http’)
const username = ‘username’
const password = ‘password’
const auth = 'Basic ’ + Buffer.from(username + ‘:’ + password).toString(‘base64’)

host: ‘’, // IP address of proxy server
port: 8080, // port of proxy server
method: ‘CONNECT’,
path: ‘’, // some destination, add 443 port for https!
// headers: {
// ‘Proxy-Authorization’: auth
// },
}).on(‘connect’, (res, socket) => {
if (res.statusCode === 200) { // connected to proxy server
// ABI code

    var web3 = new Web3(new Web3.providers.HttpProvider(""));
    web3.eth.defaultAccount = web3.eth.accounts[0];
    var Coursetro = web3.eth.contract(ABI).at(CONTRACT_ADDRESS);

}).on(‘error’, (err) => {
console.error(‘error’, err)

Hi, could you also provide the error you are receiving?

Hi Mike

I am getting not able to connect to

we get the following error “Invalid JSON RPC response: undefined”.

If you observe , as we are behind an enterprise firewall , they have blocked but can connect to it after a proxy server call and authentication.

I am not sure we3.provider.Httpprovider will identify that a proxy call has been made and socket object is availabe

Unfortunately we do not support this configuration when sending requests. We will keep you updated if this changes.