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

http-proxy-middleware

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-proxy-middleware - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1-alpha.1

33

dist/handlers/response-interceptor.js

@@ -31,4 +31,4 @@ "use strict";

_proxyRes.on('end', () => __awaiter(this, void 0, void 0, function* () {
// set original content type from upstream
res.setHeader('content-type', originalProxyRes.headers['content-type'] || '');
// copy original headers
copyHeaders(proxyRes, res);
// call interceptor with intercepted response (buffer)

@@ -74,1 +74,30 @@ const interceptedBuffer = Buffer.from(yield interceptor(buffer, originalProxyRes, req, res));

}
/**
* Copy original headers
* https://github.com/apache/superset/blob/9773aba522e957ed9423045ca153219638a85d2f/superset-frontend/webpack.proxy-config.js#L78
*/
function copyHeaders(originalResponse, response) {
response.statusCode = originalResponse.statusCode;
response.statusMessage = originalResponse.statusMessage;
if (response.setHeader) {
let keys = Object.keys(originalResponse.headers);
// ignore chunked, brotli, gzip, deflate headers
keys = keys.filter((key) => !['content-encoding', 'transfer-encoding'].includes(key));
keys.forEach((key) => {
let value = originalResponse.headers[key];
if (key === 'set-cookie') {
// remove cookie domain
value = Array.isArray(value) ? value : [value];
value = value.map((x) => x.replace(/Domain=[^;]+?/i, ''));
}
else if (key === 'location') {
// set redirects to use local URL
// value = (value || '').replace(target, ''); // TODO
}
response.setHeader(key, value);
});
}
else {
response.headers = originalResponse.headers;
}
}

2

package.json
{
"name": "http-proxy-middleware",
"version": "1.2.0",
"version": "1.2.1-alpha.1",
"description": "The one-liner node.js proxy middleware for connect, express and browser-sync",

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

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