Registry / http-networking / tunnel

tunnel

JSON →
library1.0.0jsnpmunverified

The `tunnel` package, currently at version 0.0.6, provides `http.Agent` and `https.Agent` implementations specifically designed for tunneling HTTP and HTTPS traffic through various types of proxies (HTTP over HTTP, HTTPS over HTTP, HTTP over HTTPS, HTTPS over HTTPS). It targets extremely old Node.js environments, supporting versions `0.6.11` through `0.7.0`, and `0.7.3` (as indicated by its `engines` field). This package is considered abandoned, with no new releases or maintenance since 2014, and is not compatible with modern Node.js runtimes. Its primary differentiator was its early support for detailed proxy configurations for different tunneling scenarios within the Node.js `http` module ecosystem, but it has been superseded by actively maintained alternatives.

npm install tunnel
INSTALL
IMPORT
SIG · TUNNEL
T
tunnel
http-networkingjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

tunnel
const tunnel = require('tunnel');
import tunnel from 'tunnel';
This package exclusively uses CommonJS `require` syntax as it predates widespread Node.js ESM adoption. The `tunnel` variable will hold an object containing the agent creation functions.
httpsOverHttp
const { httpsOverHttp } = require('tunnel');
import { httpsOverHttp } from 'tunnel';
While CommonJS, direct destructuring of properties like `httpsOverHttp` might not have been a common or reliable pattern in Node.js versions targeted by this package. It's safer to access via `tunnel.httpsOverHttp`.

This example demonstrates how to create an `httpsOverHttp` tunneling agent and use it with `https.request` to make a secure HTTP request through an HTTP proxy. It highlights the basic configuration for the proxy settings and includes error handling.

const tunnel = require('tunnel'); const https = require('https'); const tunnelingAgent = tunnel.httpsOverHttp({ proxy: { host: 'localhost', port: 3128, proxyAuth: process.env.PROXY_AUTH ?? '', // Example: 'user:password' headers: { 'User-Agent': 'Node.js Tunnel Example' } } }); const options = { host: 'example.com', port: 443, agent: tunnelingAgent, path: '/', method: 'GET' }; const req = https.request(options, (res) => { console.log(`STATUS: ${res.statusCode}`); console.log(`HEADERS: ${JSON.stringify(res.headers)}`); res.setEncoding('utf8'); res.on('data', (chunk) => { console.log(`BODY: ${chunk}`); }); res.on('end', () => { console.log('No more data in response.'); }); }); req.on('error', (e) => { console.error(`problem with request: ${e.message}`); }); req.end();
Debug
Known issues
breakingThe `tunnel` package is abandoned and last updated in 2014. It explicitly targets Node.js versions `<=0.7.x` and is incompatible with all modern Node.js versions (>=1.0.0), leading to runtime errors.
fix
Do not use this package. Migrate to actively maintained alternatives such as `https-proxy-agent` or `socks-proxy-agent`.
affects: all
breakingDue to its abandonment, this package has not received any security updates. It may contain unpatched vulnerabilities related to network communication, proxy handling, or certificate validation, posing significant security risks.
fix
Immediately cease use of this package in production. Replace it with a well-maintained, modern proxy agent library.
affects: all
gotchaThe API for `http.Agent` and `https.Agent` has evolved significantly since Node.js 0.7.x. Attempting to use `tunnel` with newer Node.js versions will result in `TypeError`s or unexpected behavior due to incompatible method signatures and internal changes.
fix
This package cannot be made compatible with modern Node.js. Use contemporary libraries designed for current Node.js APIs.
affects: all
Errors
Common errors & fixes
TypeError: tunnelingAgent.addRequest is not a function
This error occurs because internal APIs of Node.js's `http.Agent` and `https.Agent` classes changed significantly after the versions supported by the `tunnel` package (<=0.7.x). Modern Node.js versions do not expose or expect the `addRequest` method in the same way.
fix
This package is incompatible with modern Node.js. Use an alternative like `https-proxy-agent` which is actively maintained and designed for current Node.js versions.
Error: Cannot find module 'tunnel'
This typically indicates the package is not installed, or npm failed to install it correctly due to compatibility issues with your Node.js version, or the package entry on the registry might be broken for older versions.
fix
First, ensure `npm install tunnel` completes successfully. If not, it reinforces that the package is too old or broken. The recommended fix is to abandon this package and use a modern, actively maintained proxy agent library.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
tunnel — npm install tunnel · libregistry