[CORD-1232] Filtering events based on updated properies
Change-Id: If96da2f5c987f487b4d8b9ec7c68e44869cb4e12
diff --git a/conf/browsersync.conf.js b/conf/browsersync.conf.js
index 391f688..3f262ba 100644
--- a/conf/browsersync.conf.js
+++ b/conf/browsersync.conf.js
@@ -1,6 +1,7 @@
const conf = require('./gulp.conf');
const proxy = require('./proxy').proxy;
const extensionsProxy = require('./proxy').extensionsProxy;
+const socketProxy = require('./proxy').socketProxy;
module.exports = function () {
return {
@@ -10,9 +11,12 @@
conf.paths.src
],
middleware: function(req, res, next){
- if (req.url.indexOf('xosapi') !== -1 || req.url.indexOf('socket.io') !== -1) {
+ if (req.url.indexOf('xosapi') !== -1) {
proxy.web(req, res);
}
+ else if (req.url.indexOf('socket.io') !== -1) {
+ socketProxy.web(req, res);
+ }
else if (req.url.indexOf('extensions') !== -1) {
extensionsProxy.web(req, res);
}
diff --git a/conf/proxy.js b/conf/proxy.js
index 8af184d..d45a27b 100644
--- a/conf/proxy.js
+++ b/conf/proxy.js
@@ -3,21 +3,34 @@
const target = process.env.PROXY || '192.168.46.100';
const proxy = httpProxy.createProxyServer({
- target: `http://${target}:9101`
+ target: `http://${target}`
});
const extensionsProxy = httpProxy.createProxyServer({
target: `http://${target}/xos/`
});
+const socketProxy = httpProxy.createProxyServer({
+ target: `http://${target}/`
+});
+
proxy.on('error', function(error, req, res) {
- res.writeHead(500, {
- 'Content-Type': 'text/plain'
- });
+ res.writeHead(500, {'Content-Type': 'text/plain'});
console.error('[Proxy]', error);
});
+extensionsProxy.on('error', function(error, req, res) {
+ res.writeHead(500, {'Content-Type': 'text/plain'});
+ console.error('[extensionsProxy]', error);
+});
+
+socketProxy.on('error', function(error, req, res) {
+ res.writeHead(500, {'Content-Type': 'text/plain'});
+ console.error('[socketProxy]', error);
+});
+
module.exports = {
proxy,
- extensionsProxy
+ extensionsProxy,
+ socketProxy
};
\ No newline at end of file