
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
The tunnel npm package is designed to help create secure and reliable tunneling connections over HTTP. It allows developers to tunnel their HTTP(S) communications through proxy servers, enabling secure and efficient data transfer even in environments with restricted internet access. This package is particularly useful for bypassing network restrictions, securely accessing remote networks, and enhancing privacy.
HTTP over HTTP tunneling
This feature allows you to tunnel HTTP requests through an HTTP proxy. It's useful for sending requests from behind a corporate firewall.
const tunnel = require('tunnel');
const tunnelingAgent = tunnel.httpOverHttp({
proxy: {
host: 'localhost',
port: 8080
}
});
require('http').request({
host: 'example.com',
port: 80,
agent: tunnelingAgent
});
HTTPS over HTTP tunneling
This feature enables HTTPS requests to be tunneled through an HTTP proxy. It's particularly useful for secure communication through a non-secure proxy server.
const tunnel = require('tunnel');
const tunnelingAgent = tunnel.httpsOverHttp({
proxy: {
host: 'localhost',
port: 8080
}
});
require('https').request({
host: 'example.com',
port: 443,
agent: tunnelingAgent
});
HTTPS over HTTPS tunneling
This feature allows for HTTPS requests to be tunneled through an HTTPS proxy, enhancing security by encrypting both the tunnel and the proxied requests.
const tunnel = require('tunnel');
const tunnelingAgent = tunnel.httpsOverHttps({
proxy: {
host: 'localhost',
port: 8080
}
});
require('https').request({
host: 'example.com',
port: 443,
agent: tunnelingAgent
});
http-proxy is a full-featured HTTP proxy library that supports websockets. It is designed to help developers easily forward HTTP requests and handle proxying needs. Compared to tunnel, http-proxy offers a broader set of features for proxying but does not focus exclusively on tunneling through proxies.
global-agent is a global HTTP/HTTPS proxy agent capable of handling requests across multiple HTTP clients. Unlike tunnel, which is focused on creating tunnel connections, global-agent is designed to configure a global proxy agent for the application, making it easier to manage proxy settings in a centralized manner.
var tunnel = require('tunnel');
var tunnelingAgent = tunnel.httpsOverHttp({
proxy: {
host: 'localhost',
port: 3128
}
});
var req = https.request({
host: 'example.com',
port: 443,
agent: tunnelingAgent
});
$ npm install tunnel
var tunnelingAgent = tunnel.httpOverHttp({
maxSockets: poolSize, // Defaults to http.Agent.defaultMaxSockets
proxy: { // Proxy settings
host: proxyHost, // Defaults to 'localhost'
port: proxyPort, // Defaults to 80
localAddress: localAddress, // Local interface if necessary
// Basic authorization for proxy server if necessary
proxyAuth: 'user:password',
// Header fields for proxy server if necessary
headers: {
'User-Agent': 'Node'
}
}
});
var req = http.request({
host: 'example.com',
port: 80,
agent: tunnelingAgent
});
var tunnelingAgent = tunnel.httpsOverHttp({
maxSockets: poolSize, // Defaults to http.Agent.defaultMaxSockets
// CA for origin server if necessary
ca: [ fs.readFileSync('origin-server-ca.pem')],
// Client certification for origin server if necessary
key: fs.readFileSync('origin-server-key.pem'),
cert: fs.readFileSync('origin-server-cert.pem'),
proxy: { // Proxy settings
host: proxyHost, // Defaults to 'localhost'
port: proxyPort, // Defaults to 80
localAddress: localAddress, // Local interface if necessary
// Basic authorization for proxy server if necessary
proxyAuth: 'user:password',
// Header fields for proxy server if necessary
headers: {
'User-Agent': 'Node'
},
}
});
var req = https.request({
host: 'example.com',
port: 443,
agent: tunnelingAgent
});
var tunnelingAgent = tunnel.httpOverHttps({
maxSockets: poolSize, // Defaults to http.Agent.defaultMaxSockets
proxy: { // Proxy settings
host: proxyHost, // Defaults to 'localhost'
port: proxyPort, // Defaults to 443
localAddress: localAddress, // Local interface if necessary
// Basic authorization for proxy server if necessary
proxyAuth: 'user:password',
// Header fields for proxy server if necessary
headers: {
'User-Agent': 'Node'
},
// CA for proxy server if necessary
ca: [ fs.readFileSync('origin-server-ca.pem')],
// Server name for verification if necessary
servername: 'example.com',
// Client certification for proxy server if necessary
key: fs.readFileSync('origin-server-key.pem'),
cert: fs.readFileSync('origin-server-cert.pem'),
}
});
var req = http.request({
host: 'example.com',
port: 80,
agent: tunnelingAgent
});
var tunnelingAgent = tunnel.httpsOverHttps({
maxSockets: poolSize, // Defaults to http.Agent.defaultMaxSockets
// CA for origin server if necessary
ca: [ fs.readFileSync('origin-server-ca.pem')],
// Client certification for origin server if necessary
key: fs.readFileSync('origin-server-key.pem'),
cert: fs.readFileSync('origin-server-cert.pem'),
proxy: { // Proxy settings
host: proxyHost, // Defaults to 'localhost'
port: proxyPort, // Defaults to 443
localAddress: localAddress, // Local interface if necessary
// Basic authorization for proxy server if necessary
proxyAuth: 'user:password',
// Header fields for proxy server if necessary
headers: {
'User-Agent': 'Node'
}
// CA for proxy server if necessary
ca: [ fs.readFileSync('origin-server-ca.pem')],
// Server name for verification if necessary
servername: 'example.com',
// Client certification for proxy server if necessary
key: fs.readFileSync('origin-server-key.pem'),
cert: fs.readFileSync('origin-server-cert.pem'),
}
});
var req = https.request({
host: 'example.com',
port: 443,
agent: tunnelingAgent
});
Licensed under the MIT license.
FAQs
Node HTTP/HTTPS Agents for tunneling proxies
The npm package tunnel receives a total of 7,299,082 weekly downloads. As such, tunnel popularity was classified as popular.
We found that tunnel demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.