solr-proxy
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -0,1 +1,6 @@ | ||
2.1.0 | ||
===== | ||
* Add SSL capability to the proxy. | ||
2.0.0 | ||
@@ -2,0 +7,0 @@ ===== |
20
index.js
@@ -1,3 +0,2 @@ | ||
var http = require('http'), | ||
httpProxy = require('http-proxy'), | ||
var httpProxy = require('http-proxy'), | ||
url = require('url'), | ||
@@ -39,6 +38,4 @@ extend = require('xtend'), | ||
var createServer = function(options) { | ||
var proxyTarget = 'http://' + options.backend.host + ':' + options.backend.port; | ||
var proxy = httpProxy.createProxyServer({target: options.backend}); | ||
var proxy = httpProxy.createProxyServer({target: proxyTarget}); | ||
proxy.on('error', function(err, req, res) { | ||
@@ -49,4 +46,13 @@ res.writeHead(502, { 'Content-Type': 'text/plain' }); | ||
// adapted from http://git.io/k5dCxQ | ||
var server = http.createServer(function(request, response) { | ||
var createServer; | ||
if (options.ssl) { | ||
const https = require('https'); | ||
createServer = (callback) => https.createServer(options.ssl, callback); | ||
} else { | ||
const http = require('http'); | ||
createServer = http.createServer; | ||
} | ||
// adapted from https://git.io/k5dCxQ | ||
var server = createServer(function(request, response) { | ||
if (validateRequest(request, options)) { | ||
@@ -53,0 +59,0 @@ debug('ALLOWED: ' + request.method + ' ' + request.url); |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"author": "Rich Trott <rtrott@gmail.com>", | ||
@@ -13,0 +13,0 @@ "bugs": { |
@@ -75,2 +75,15 @@ solr-proxy | ||
To enable TLS for your proxy, include an `ssl` object within the `options` | ||
object. | ||
```js | ||
var options = { | ||
ssl: { | ||
key: fs.readFileSync('key.pem'), | ||
cert: fs.readFileSync('cert.pem'), | ||
} | ||
}; | ||
var proxy = SolrProxy.start(null, options); | ||
``` | ||
To enable verbose logging, set environment variable `DEBUG` to include `solr-proxy`. | ||
@@ -77,0 +90,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
10016
130
110