You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

simple-http-proxy

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-http-proxy - npm Package Compare versions

Comparing version

to
0.5.7

19

index.js

@@ -34,2 +34,11 @@

var xforward;
// x-forward headers
if (opts.xforward) {
xforward = {};
['proto', 'host', 'path', 'port'].forEach(function(header) {
xforward[header] = opts.xforward[header] || 'x-forwarded-' + header;
});
}
return function simpleHttpProxy(req, res, next) {

@@ -58,3 +67,3 @@ // Get our forwarding info

// Enable forwarding headers
if(opts.xforward) {
if(xforward) {
// Get the path at which the middleware is mounted

@@ -67,7 +76,7 @@ var resPath = req.originalUrl.replace(req.url, '');

// Pass along our headers
options.headers[opts.xforward.proto || 'x-forwarded-proto'] = req.connection.encrypted ? 'https' : 'http';
options.headers[opts.xforward.host || 'x-forwarded-host'] = hostInfo[0];
options.headers[opts.xforward.path || 'x-forwarded-path'] = resPath;
options.headers[xforward.proto] = req.headers[xforward.proto] || req.connection.encrypted ? 'https' : 'http';
options.headers[xforward.host] = req.headers[xforward.host] || hostInfo[0];
options.headers[xforward.path] = req.headers[xforward.path] || resPath;
if (hostInfo[1]) options.headers[opts.xforward.port || 'x-forwarded-port'] = hostInfo[1];
if (hostInfo[1]) options.headers[xforward.port] = req.headers[xforward.port] || hostInfo[1];
}

@@ -74,0 +83,0 @@

{
"name": "simple-http-proxy",
"version": "0.5.6",
"version": "0.5.7",
"description": "Simple proxy middleware",

@@ -5,0 +5,0 @@ "main": "index.js",