Skip to content

Commit c77a7ce

Browse files
committed
log all trafic
1 parent 7f8d632 commit c77a7ce

5 files changed

Lines changed: 17 additions & 7 deletions

File tree

OpenFlow/src/WebServer.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import * as cookieParser from "cookie-parser";
99
import * as cookieSession from "cookie-session";
1010
import * as crypto from "crypto";
1111
import * as flash from "flash";
12+
import * as morgan from "morgan";
1213

1314
import * as samlp from "samlp";
1415
import { SamlProvider } from "./SamlProvider";
@@ -24,6 +25,7 @@ export class WebServer {
2425
this._logger = logger;
2526

2627
this.app = express();
28+
this.app.use(morgan('combined', { stream: (winston.stream as any).write }));
2729
this.app.use(compression());
2830
this.app.use(bodyParser.urlencoded({ extended: true }));
2931
this.app.use(bodyParser.json());
@@ -85,13 +87,17 @@ export class WebServer {
8587
}
8688
server = https.createServer(options, this.app);
8789

88-
var redirapp = express();
89-
var _http = http.createServer(redirapp);
90-
redirapp.get('*', function (req, res) {
91-
//res.redirect('https://' + req.headers.host + req.url);
92-
res.status(200).json({ status: "ok" });
93-
})
90+
91+
var _http = http.createServer(this.app);
9492
_http.listen(80);
93+
94+
// var redirapp = express();
95+
// var _http = http.createServer(redirapp);
96+
// redirapp.get('*', function (req, res) {
97+
// //res.redirect('https://' + req.headers.host + req.url);
98+
// res.status(200).json({ status: "ok" });
99+
// })
100+
// _http.listen(80);
95101
} else {
96102
server = http.createServer(this.app);
97103
}

OpenFlowNodeRED/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"express": "^4.16.4",
2323
"gulp-shell": "^0.7.0",
2424
"jsonwebtoken": "^8.5.1",
25+
"morgan": "^1.9.1",
2526
"node-red": "^0.20.5",
2627
"node-red-contrib-auth-saml": "^1.0.8",
2728
"passport-google-oauth20": "^2.0.0",

OpenFlowNodeRED/src/WebServer.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as compression from "compression";
77
import * as bodyParser from "body-parser";
88
import * as cookieParser from "cookie-parser";
99
import * as nodered from "node-red";
10+
import * as morgan from "morgan";
1011

1112
import * as samlauth from "node-red-contrib-auth-saml";
1213
import * as cookieSession from "cookie-session";
@@ -35,6 +36,7 @@ export class WebServer {
3536
this._logger.debug("WebServer.configure::begin");
3637
if (this.app === null) {
3738
this.app = express();
39+
this.app.use(morgan('combined', { stream: (winston.stream as any).write }));
3840
this.app.use(compression());
3941
this.app.use(bodyParser.urlencoded({ limit: '10mb', extended: true }))
4042
this.app.use(bodyParser.json({ limit: '10mb' }))

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.160
1+
0.0.161

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"jsondiffpatch": "^0.3.11",
3939
"jsonwebtoken": "^8.5.1",
4040
"mongodb": "^3.2.3",
41+
"morgan": "^1.9.1",
4142
"node-red-contrib-auth-saml": "^1.0.6",
4243
"npm": "^6.9.0",
4344
"passport": "^0.4.0",

0 commit comments

Comments
 (0)