Skip to content

Commit

Permalink
fix #518
Browse files Browse the repository at this point in the history
  • Loading branch information
mStirner committed Feb 3, 2025
1 parent 47cfdec commit 6ca7d9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ process.env = Object.assign({
MQTT_BROKER_VERSION: "4",
MQTT_CLIENT_ID: "OpenHaus",
MQTT_PING_INTERVAL: "5000",
CONNECT_TIMEOUT: "10000"
CONNECT_TIMEOUT: "10000",
HTTP_TRUSTED_PROXYS: "loopback"
}, env.parsed, process.env);


Expand Down
10 changes: 5 additions & 5 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ const about = express.Router();
//const system = express.Router();

// https://expressjs.com/en/guide/behind-proxies.html
app.set("trust proxy", [
"loopback",
"linklocal",
"uniquelocal"
]);
app.set("trust proxy", process.env.HTTP_TRUSTED_PROXYS.split(","));

// fix #409
// add logging for http requests
Expand All @@ -67,10 +63,14 @@ app.use((req, res, next) => {
headers: req.headers
}));

//res.removeHeader("x-powered-by");
//res.setHeader("x-timestamp", Date.now());

next();

});

// NOTE: Remove limit?, since when is a 25mb json needed?!
app.use(bodyParser.json({
limit: (Number(process.env.API_LIMIT_SIZE) * 1024) // default to 25, (=25mb)
}));
Expand Down

0 comments on commit 6ca7d9e

Please sign in to comment.