mirror of https://github.com/calzoneman/sync.git
Ok this should actually fix it
This commit is contained in:
parent
2ea9dbcb75
commit
731ab3f9a5
|
@ -14,6 +14,9 @@ var cookieParser = require("cookie-parser");
|
|||
var static = require("serve-static");
|
||||
var morgan = require("morgan");
|
||||
|
||||
const LOG_FORMAT = ':real-address - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"';
|
||||
morgan.token('real-address', function (req) { return req._ip; });
|
||||
|
||||
/**
|
||||
* Extracts an IP address from a request. Uses X-Forwarded-For if the IP is localhost
|
||||
*/
|
||||
|
@ -202,12 +205,12 @@ module.exports = {
|
|||
*/
|
||||
init: function (app) {
|
||||
app.use(function (req, res, next) {
|
||||
req.ip = ipForRequest(req);
|
||||
req._ip = ipForRequest(req);
|
||||
next();
|
||||
});
|
||||
app.use(bodyParser.urlencoded({ extended: false }));
|
||||
app.use(cookieParser());
|
||||
app.use(morgan("combined", {
|
||||
app.use(morgan(LOG_FORMAT, {
|
||||
stream: require("fs").createWriteStream(path.join(__dirname, "..", "..",
|
||||
"http.log"), {
|
||||
flags: "a",
|
||||
|
|
Loading…
Reference in New Issue