blob: 8af184d5def59f9963c20eed2a8dd08da7706d57 [file] [log] [blame]
Matteo Scandoloc80ccbd2017-02-27 16:24:33 -08001const httpProxy = require('http-proxy');
2
Matteo Scandolo47c53fc2017-03-23 14:11:32 -07003const target = process.env.PROXY || '192.168.46.100';
4
Matteo Scandoloc80ccbd2017-02-27 16:24:33 -08005const proxy = httpProxy.createProxyServer({
Matteo Scandolo47c53fc2017-03-23 14:11:32 -07006 target: `http://${target}:9101`
Matteo Scandoloc80ccbd2017-02-27 16:24:33 -08007});
8
Matteo Scandolo98b5f5d2017-03-17 17:09:05 -07009const extensionsProxy = httpProxy.createProxyServer({
Matteo Scandolo37d56062017-04-24 15:03:00 -070010 target: `http://${target}/xos/`
Matteo Scandolo98b5f5d2017-03-17 17:09:05 -070011});
12
Matteo Scandoloc80ccbd2017-02-27 16:24:33 -080013proxy.on('error', function(error, req, res) {
14 res.writeHead(500, {
15 'Content-Type': 'text/plain'
16 });
17 console.error('[Proxy]', error);
18});
19
Matteo Scandolo98b5f5d2017-03-17 17:09:05 -070020module.exports = {
21 proxy,
22 extensionsProxy
23};