Reset content provider environment
diff --git a/views/ngXosViews/contentProvider/env/default.js b/views/ngXosViews/contentProvider/env/default.js
new file mode 100644
index 0000000..6370c0c
--- /dev/null
+++ b/views/ngXosViews/contentProvider/env/default.js
@@ -0,0 +1,13 @@
+// This is a default configuration for your development environment.
+// You can duplicate this configuration for any of your Backend Environments.
+// Different configurations are loaded setting a NODE_ENV variable that contain the config file name.
+// `NODE_ENV=local npm start`
+//
+// If xoscsrftoken or xossessionid are not specified the browser value are used
+// (works only for local environment as both application are served on the same domain)
+
+module.exports = {
+ host: 'http://apt020.apt.emulab.net:9999/',
+ xoscsrftoken: 'H6rV67DUIoxw9nBfWlCuUWPckyj10Hx2',
+ xossessionid: 'q7oc8zw5g2awk7n7hme7pmftukkwtf9d'
+};
diff --git a/views/ngXosViews/contentProvider/gulp/server.js b/views/ngXosViews/contentProvider/gulp/server.js
index 8eab1bf..f16d6f2 100644
--- a/views/ngXosViews/contentProvider/gulp/server.js
+++ b/views/ngXosViews/contentProvider/gulp/server.js
@@ -10,8 +10,17 @@
var httpProxy = require('http-proxy');
var del = require('del');
+const environment = process.env.NODE_ENV;
+
+if (environment){
+ var conf = require(`../env/${environment}.js`);
+}
+else{
+ var conf = require('../env/default.js')
+}
+
var proxy = httpProxy.createProxyServer({
- target: 'http://0.0.0.0:9999'
+ target: conf.host || 'http://0.0.0.0:9999'
});
@@ -49,6 +58,10 @@
req.url.indexOf('/xoslib/') !== -1 ||
req.url.indexOf('/hpcapi/') !== -1
){
+ if(conf.xoscsrftoken && conf.xossessionid){
+ req.headers.cookie = `xoscsrftoken=${conf.xoscsrftoken}; xossessionid=${conf.xossessionid}`;
+ req.headers['x-csrftoken'] = conf.xoscsrftoken;
+ }
proxy.web(req, res);
}
else{