question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add Proxy support

See original GitHub issue

Hello! Is it possible to add support of socks5, socks4, http and https proxies? something like this:

axios({
	method: 'GET',
	url: 'https://google.com',
	proxyurl: 'socks://196.146.157.1:1486',
})

or

axios({
	method: 'GET',
	url: 'https://google.com',
	proxytype: 'socks5',
	proxy: '196.146.157.1:1486'
})

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:9
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

13reactions
pheebcodescommented, Jul 24, 2018

You can currently use HTTP(s) proxies with the proxy option. You can create an axios instance with these options so you don’t have to specify them with each request. Socks proxies are not supported.

axios.get({
  url: '/test',

  // 'proxy' defines the hostname and port of the proxy server
  // Use `false` to disable proxies, ignoring environment variables.
  // `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and
  // supplies credentials.
  // This will set an `Proxy-Authorization` header, overwriting any existing
  // `Proxy-Authorization` custom headers you have set using `headers`.
  proxy: {
    host: '127.0.0.1',
    port: 9000,
    auth: {
      username: 'mikeymike',
      password: 'rapunz3l'
    }
  }
});

// or

axios.get('/test', {
  proxy: {
    host: '127.0.0.1',
    port: 9000,
    auth: {
      username: 'mikeymike',
      password: 'rapunz3l'
    }
  }
});

// or

const inst = axios.create({
  proxy: {
    host: '127.0.0.1',
    port: 9000,
    auth: {
      username: 'mikeymike',
      password: 'rapunz3l'
    }
  }
});

inst.get('/test');
1reaction
rosticoscommented, Nov 11, 2019

Maybe it`s not in related, but when I use axios proxy to send a request in corporate network, i got an error like this… photo_2019-11-11_12-46-35 On that screenshot: “Access denied”

The code that i used:

response = await axios.post(
              url,
              body,
              {
                headers,
                proxy: {
                  host,
                  port
                }
              }
            )

After several hours i have made a decision to make a unirest request and it worked like i expected

            const {body, status} = await unirest
              .post(url)
              .headers({
                'Content-Type': 'application/x-www-form-urlencoded;'
              })
              .proxy(`http://${host}:${port}}`)
              .send(body)
            response = body
Read more comments on GitHub >

github_iconTop Results From Across the Web

Proxy Support - Signal Support
The app can automatically configure proxy support when you tap on a link or scan the QR code from any other app. Manage...
Read more >
Use a proxy server in Windows - Microsoft Support
To set up a proxy server connection manually · Select the Start button, then select Settings > Network & internet > Proxy. ·...
Read more >
How to Set Up a Proxy Server on Your PC, Mac, or Web Browser
Press the Windows + I keys simultaneously to access the Windows Settings menu. · On Windows 10, click Settings > Network & Internet...
Read more >
9. Proxy Support — Ansible Tower Administration Guide v3.3.1
To provide proxy server support, Tower handles proxied requests (such as ELB in front of Tower, HAProxy, Squid, and tinyproxy) via the REMOTE_HOST_HEADERS...
Read more >
VEN Proxy Support - Illumio Technical Documentation
Configuration for a Windows Proxy Server ... If proxies are statistically configured, you can configure using one of the following two methods: ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found