trafficcontrol-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dewr...@apache.org
Subject [3/3] incubator-trafficcontrol git commit: updates libraries, rewrites https redirect and mounts directory to access ssl certs from docker
Date Tue, 09 May 2017 13:59:38 GMT
updates libraries, rewrites https redirect and mounts directory to access ssl certs from docker


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/c07c82c2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/c07c82c2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/c07c82c2

Branch: refs/heads/master
Commit: c07c82c2dbe5a9294a074f76682b6c860cf1863b
Parents: 38c9da3
Author: Jeremy Mitchell <mitchell852@gmail.com>
Authored: Mon May 8 20:22:36 2017 -0600
Committer: Dewayne Richardson <dewrich@apache.org>
Committed: Tue May 9 07:59:31 2017 -0600

----------------------------------------------------------------------
 .../experimental/ui/docker/docker-compose.yml   |  1 +
 traffic_ops/experimental/ui/package.json        | 15 +++++++------
 traffic_ops/experimental/ui/server.js           | 22 +++++++++++++++-----
 3 files changed, 25 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c07c82c2/traffic_ops/experimental/ui/docker/docker-compose.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/docker/docker-compose.yml b/traffic_ops/experimental/ui/docker/docker-compose.yml
index d1ba3fd..c8354ed 100644
--- a/traffic_ops/experimental/ui/docker/docker-compose.yml
+++ b/traffic_ops/experimental/ui/docker/docker-compose.yml
@@ -22,6 +22,7 @@ services:
       - 80:8080
     volumes:
       - /etc/traffic_ops_ui/conf:/etc/traffic_ops_ui/conf
+      - /etc/pki/tls:/etc/pki/tls
     networks:
       - default
 

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c07c82c2/traffic_ops/experimental/ui/package.json
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/package.json b/traffic_ops/experimental/ui/package.json
index 4912832..b7856ad 100755
--- a/traffic_ops/experimental/ui/package.json
+++ b/traffic_ops/experimental/ui/package.json
@@ -4,17 +4,16 @@
     "description": "Traffic Ops UI",
     "repository": {
         "type": "git",
-        "url": "git@github.com:Comcast/traffic_control.git"
+        "url": "git@github.com:apache/incubator-trafficcontrol.git"
     },
     "devDependencies": {
         "morgan": "1.7.0",
-        "errorhandler": "1.4.3",
-        "connect-modrewrite": "0.8.5",
-        "connect-timeout": "1.7.0",
+        "connect-modrewrite": "0.10.1",
+        "connect-timeout": "1.8.0",
+        "ssl-root-cas": "1.2.3",
+        "express": "4.15.2",
+        "requirejs": "2.3.3",
         "connect-livereload": "0.5.4",
-        "ssl-root-cas": "1.1.10",
-        "express": "4.13.4",
-        "requirejs": "2.1.22",
         "grunt": "0.4.5",
         "grunt-adam-compass": "0.7.1",
         "grunt-browserify2": "0.1.8",
@@ -38,6 +37,6 @@
         "time-grunt": "1.3.0"
     },
     "engines": {
-        "node": ">=0.12.0"
+        "node": "0.11.14"
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c07c82c2/traffic_ops/experimental/ui/server.js
----------------------------------------------------------------------
diff --git a/traffic_ops/experimental/ui/server.js b/traffic_ops/experimental/ui/server.js
index 2960039..ac577fb 100644
--- a/traffic_ops/experimental/ui/server.js
+++ b/traffic_ops/experimental/ui/server.js
@@ -24,7 +24,6 @@ var constants = require('constants'),
     path = require('path'),
     fs = require('fs'),
     morgan = require('morgan'),
-    errorhandler = require('errorhandler'),
     modRewrite = require('connect-modrewrite'),
     timeout = require('connect-timeout');
 
@@ -44,16 +43,30 @@ var logStream = fs.createWriteStream(config.log.stream, { flags: 'a' }),
 process.env.NODE_TLS_REJECT_UNAUTHORIZED = config.reject_unauthorized;
 
 var app = express();
+
+app.use(function(req, res, next) {
+    var err = null;
+    try {
+        decodeURIComponent(req.path)
+    }
+    catch(e) {
+        err = e;
+    }
+    if (err){
+        console.log(err, req.url);
+    }
+    next();
+});
+
 // Add a handler to inspect the req.secure flag (see
 // http://expressjs.com/api#req.secure). This allows us
 // to know whether the request was via http or https.
 app.all ("/*", function (req, res, next) {
     if (useSSL && !req.secure) {
-        var headersHost = req.headers.host.split(':');
-        var httpsUrl = 'https://' + headersHost[0] + ':' +  config.sslPort + req.url;
         // request was via http, so redirect to https
-        res.redirect(httpsUrl);
+        return res.redirect(['https://', req.get('Host'), ':', config.sslPort, req.url].join(''));
     } else {
+        // request was via https or useSSL=false, so do no special handling
         next();
     }
 });
@@ -68,7 +81,6 @@ app.use(morgan('combined', {
     stream: logStream,
     skip: function (req, res) { return res.statusCode < 400 }
 }));
-app.use(errorhandler());
 app.use(timeout(config.timeout));
 
 if (app.get('env') === 'dev') {


Mime
View raw message