New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

local-cors-proxy

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

local-cors-proxy - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

6

bin/lcp.js

@@ -13,3 +13,5 @@ #!/usr/bin/env node

},
{ name: 'proxyUrl', type: String }
{ name: 'proxyUrl', type: String },
{ name: 'credentials', type: Boolean, defaultValue: false },
{ name: 'origin', type: String, defaultValue: '*' }
];

@@ -22,5 +24,5 @@

}
lcp.startProxy(options.port, options.proxyUrl, options.proxyPartial);
lcp.startProxy(options.port, options.proxyUrl, options.proxyPartial, options.credentials, options.origin);
} catch (error) {
console.error(error);
}

@@ -7,5 +7,5 @@ var express = require('express');

var startProxy = function(port, proxyUrl, proxyPartial) {
proxy.use(cors());
proxy.options('*', cors());
var startProxy = function(port, proxyUrl, proxyPartial, credentials, origin) {
proxy.use(cors({credentials: credentials, origin: origin}));
proxy.options('*', cors({credentials: credentials, origin: origin}));

@@ -21,3 +21,13 @@ // remove trailing slash

} catch (e) {}
req.pipe(request(cleanProxyUrl + req.url)).pipe(res);
req.pipe(
request(cleanProxyUrl + req.url)
.on('response', response => {
// In order to avoid https://github.com/expressjs/cors/issues/134
const accessControlAllowOriginHeader = response.headers['access-control-allow-origin']
if(accessControlAllowOriginHeader && accessControlAllowOriginHeader !== origin ){
console.log(chalk.blue('Override access-control-allow-origin header from proxified URL : ' + chalk.green(accessControlAllowOriginHeader) + '\n'));
response.headers['access-control-allow-origin'] = origin;
}
})
).pipe(res);
});

@@ -31,3 +41,5 @@

console.log(chalk.blue('Proxy Partial: ' + chalk.green(cleanProxyPartial)));
console.log(chalk.blue('PORT: ' + chalk.green(port) + '\n'));
console.log(chalk.blue('PORT: ' + chalk.green(port)));
console.log(chalk.blue('Credentials: ' + chalk.green(credentials)));
console.log(chalk.blue('Origin: ' + chalk.green(origin) + '\n'));
console.log(

@@ -34,0 +46,0 @@ chalk.cyan(

{
"name": "local-cors-proxy",
"version": "1.0.2",
"version": "1.1.0",
"main": "./lib/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"start": "node ./bin/lcp.js",
"test": "echo \"No tests specified\" && exit 0"
},

@@ -17,3 +18,9 @@ "bin": {

},
"keywords": ["cors", "proxy", "simple", "node", "express"],
"keywords": [
"cors",
"proxy",
"simple",
"node",
"express"
],
"bugs": {

@@ -20,0 +27,0 @@ "url": "https://github.com/garmeeh/local-cors-proxy/issues"

@@ -54,1 +54,3 @@ # Local CORS Proxy

| --port | 8010 | 8010 |
| --credentials | (no value needed) | false |
| --origin | http://localhost:4200 | * |
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