-
Notifications
You must be signed in to change notification settings - Fork 132
Problem behind a Proxy with Tunnel #194
Copy link
Copy link
Open
Description
Hi,
We found an issue while using your module behind a proxy.
In your code, in the function proxy, you register proxyTunnel to the connect event.
// creare a new proxy tunnel, and use to connect to API URL
var proxyTunnel = http.request(options.proxy), self = this;
proxyTunnel.on('connect',function(res, socket, head){
debug("proxy connected",socket); ...
But in the follow-redirects module, the connect event is not managed:
// Create handlers that pass events from native requests
var eventHandlers = Object.create(null);
["abort", "aborted", "error", "socket", "timeout"].forEach(function (event) {
eventHandlers[event] = function (arg) {
this._redirectable.emit(event, arg);
};
});
Therefore, you never receive the connect event and the code is never triggered.
To fix this, I just added the following lines in the node-modules/follow-redirects/index.js file to manage the connect event.
eventHandlers["connect"] = function (req, cltSocket, head) {
this._redirectable.emit("connect", req, cltSocket, head);
};
I know the problem is not in your module.
It's just to let you know.
Regards & Thanks for this module !
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels