Skip to content

Commit

Permalink
add trust proxy config
Browse files Browse the repository at this point in the history
  • Loading branch information
basemkhirat committed Oct 31, 2017
1 parent a715990 commit ffa68e2
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ app.set("env", _config("app.env"));
app.set("views", _config("app.views"));
app.set("view engine", _config("app.view_engine"));
app.set("x-powered-by", _config("app.x_powered_by"));
app.set('trust proxy', 1);
app.set('trust proxy', _config("app.trust_proxy"));

module.exports = app;
Empty file added app/services/.gitkeep
Empty file.
9 changes: 9 additions & 0 deletions config/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ module.exports = {

port: process.env.PORT || 3000,

/**
* Enabling trust proxy will have the following impact:
* The value of req.hostname is derived from the value set in the X-Forwarded-Host header, which can be set by the client or by the proxy.
* X-Forwarded-Proto can be set by the reverse proxy to tell the app whether it is https or http or even an invalid name. This value is reflected by req.protocol.
* The req.ip and req.ips values are populated with the list of addresses from X-Forwarded-For.
*/

trust_proxy: true,

/**
* The x-powered-by header key
*/
Expand Down
21 changes: 13 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "express-mvc",
"name": "expressmvc",
"version": "0.0.1",
"description": "express light-weight mvc",
"main": "server.js",
Expand All @@ -20,11 +20,12 @@
"express": "^4.16.2",
"express-back": "0.0.2",
"express-flash": "0.0.2",
"express-mvc-generate": "0.0.2",
"express-session": "^1.15.6",
"express-validator": "^4.3.0",
"i18n": "^0.8.3",
"jsonwebtoken": "^8.1.0",
"mongoose": "^4.12.4",
"mongoose": "^4.12.5",
"morgan": "^1.9.0",
"passport": "^0.4.0",
"passport-jwt": "^3.0.1",
Expand Down

0 comments on commit ffa68e2

Please sign in to comment.