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.

How to configure tunneling proxy

See original GitHub issue

Problem Description

I am using proxy middleware to communicate with an endpoint which lives in open internet but I am behind a corporate proxy. So when I try to connect to the endpoint I am getting following error.

ROXY ERROR: ENOTFOUND. localhost:3000 -> https://www.example.com.au/login

I wonder how to configure agent for http-proxy-middleware.

I have tested a simple https with a agent and works fine and code as follows.

var tunnel = require('tunnel');
var tunnelingAgent = tunnel.httpsOverHttp({
  proxy: {
    host: 'office.proxy.com.au',
    port: 8080
  }
})

var https = require('https')
  var post_req = https.request({
    host: 'www.example.com.au',
    port: '443',
    path: '/logon',
    method: 'GET',
    agent: tunnelingAgent,
    timeout: 10000,
    followRedirect: true,
    maxRedirects: 10
  }, function(res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
      console.log('Response: ' + chunk);
    });
  });
  post_req.write("name=mario");
  post_req.end();

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Tits-McGeecommented, Dec 11, 2018

@chimurai Sorry to bring up such an old issue! When using this solution, proxyReq.SetHeader breaks - the error message is Cannot set headers after they are sent to the client Any help will be appreciated!

0reactions
jaredxx1commented, Sep 28, 2022

#22

Same here

Read more comments on GitHub >

github_iconTop Results From Across the Web

SSH Tunneling and Proxying | Baeldung on Linux
A special case of the forward TCP tunnels is the Socks proxy capability. Using these options, the SSH client listens on a specified...
Read more >
Proxy servers and tunneling - HTTP - MDN Web Docs
There are two types of proxies: forward proxies (or tunnel, or gateway) and reverse proxies (used to control and protect access to a...
Read more >
Configure VMware Tunnel Proxy
Navigate to Groups & Settings > All Settings > System > Enterprise Integration > VMware Tunnel Proxy > Configuration and select the Advanced...
Read more >
Proxy tunneling - FIREHOUSE Software
Proxy tunneling via the HTTP CONNECT method lets a user who accesses the Internet through a proxy server connect to FH Web Edition...
Read more >
How to SSH a Tunnel Proxy - SnapShooter Tutorials
SSH Tunneling allows access to resources on the remote server or allows access to your local resources to someone else. You will need...
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