Skip to content

Commit

Permalink
Merge pull request GitbookIO#33 from exponentjs/trust-proxy
Browse files Browse the repository at this point in the history
Introduce a "TRUST_PROXY" env var that sets Express's "trust proxy" setting
  • Loading branch information
SamyPesse committed Mar 19, 2016
2 parents 8c1f9c7 + 8ff7ba3 commit 88c99e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bin/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ myNuts.after('download', function(download, next) {
next();
});

if (process.env.TRUST_PROXY) {
app.set('trust proxy', process.env.TRUST_PROXY);
}

app.use(myNuts.router);

// Error handling
Expand Down
5 changes: 5 additions & 0 deletions docs/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ $ export GITHUB_REPO=Username/MyApp
# Authentication for the private API
$ export API_USERNAME=hello
$ export API_PASSWORD=world
# Express's "trust proxy" setting for trusting X-Forwarded-* headers when
# behind a reverse proxy like nginx
# http://expressjs.com/en/guide/behind-proxies.html
$ export TRUST_PROXY=loopback
```

Then start the application using:
Expand Down

0 comments on commit 88c99e0

Please sign in to comment.