Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-connect-proxy

Package Overview
Dependencies
Maintainers
3
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-connect-proxy - npm Package Compare versions

Comparing version 0.1.11 to 0.2.0

test/hide_headers_test.js

12

Gruntfile.js

@@ -121,2 +121,8 @@ /*

}
},
{
context: '/hideHeaders',
host: 'localhost',
port: 8081,
hideHeaders: ['x-hidden-header-1', 'x-hidden-header-2']
}

@@ -133,3 +139,4 @@ ]

utils: 'test/utils_test.js',
request: 'test/request_test.js'
request: 'test/request_test.js',
hideHeaders: 'test/hide_headers_test.js'
}

@@ -161,3 +168,4 @@

'connect:request',
'nodeunit:request'
'nodeunit:request',
'nodeunit:hideHeaders'
]);

@@ -164,0 +172,0 @@

@@ -107,2 +107,17 @@ 'use strict';

function removeHiddenHeaders(proxy) {
var hiddenHeaders = proxy.config.hideHeaders;
if(hiddenHeaders && hiddenHeaders.length > 0) {
proxy.server.on('proxyRes', function(proxyRes) {
var headers = proxyRes.headers;
hiddenHeaders.forEach(function(header) {
if(header in headers) {
delete headers[header];
}
});
});
}
}
utils.proxyRequest = function (req, res, next) {

@@ -124,3 +139,6 @@ var proxied = false;

}
proxy.server.proxyRequest(req, res);
proxy.server.proxyRequest(req, res, proxy.server);
removeHiddenHeaders(proxy);
// proxying twice would cause the writing to a response header that is already sent. Bad config!

@@ -127,0 +145,0 @@ proxied = true;

4

package.json
{
"name": "grunt-connect-proxy",
"description": "Provides a http proxy as middleware for grunt connect.",
"version": "0.1.11",
"version": "0.2.0",
"homepage": "https://github.com/drewzboto/grunt-connect-proxy",

@@ -31,3 +31,3 @@ "author": {

"dependencies": {
"http-proxy": "~1.1.4",
"http-proxy": "~1.11.0",
"lodash": "~0.9.0"

@@ -34,0 +34,0 @@ },

@@ -44,3 +44,4 @@ # grunt-connect-proxy

"x-custom-added-header": value
}
},
hideHeaders: ['x-removed-header']
}

@@ -198,2 +199,7 @@ ]

#### options.hideHeaders
Type: `Array`
An array of headers that should be removed from the server's response.
#### options.ws

@@ -200,0 +206,0 @@ Type: `Boolean`

@@ -56,2 +56,4 @@ /*

xfwd: proxyOption.xforward
}).on('error', function (err, req, res) {
grunt.log.error('Proxy error: ', err.code);
}),

@@ -58,0 +60,0 @@ config: proxyOption

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc