-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathproxyServer.js
More file actions
38 lines (32 loc) · 1008 Bytes
/
proxyServer.js
File metadata and controls
38 lines (32 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/** Copyright 2015 Board of Trustees of University of Illinois
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// Allows piwik to be served over https
// Open on PROXY_PORT
var httpProxy = require("http-proxy");
var fs = require("fs");
var dotenv = require('dotenv');
dotenv.load();
var httpsPort = process.env.PROXY_PORT || 7443;
var piwikPort = process.env.PIWIK_PORT || 7001;
var piwikHost = "192.17.96.13";
const privateKey = fs.readFileSync('./cert/privkey.pem', 'utf8');
const certificate = fs.readFileSync('./cert/cert.pem', 'utf8');
const ca = fs.readFileSync('./cert/chain.pem', 'utf8');
var options = {
target: {
host: piwikHost,
port: piwikPort
},
ssl: {
key: privateKey,
cert: certificate,
ca: ca
}
}
httpProxy.createServer(options).listen(httpsPort, function() {
console.log("https Proxy server on: " + httpsPort);
})