Express.js: Difference between revisions

Line 42: Line 42:
==Proxies==
==Proxies==
It is typically recommended to run express behind a proxy (e.g. Nginx) for production.
It is typically recommended to run express behind a proxy (e.g. Nginx) for production.
See [https://expressjs.com/en/guide/behind-proxies.html guide: behind-proxies] for how to configure this.
See [https://expressjs.com/en/guide/behind-proxies.html guide: behind-proxies] for how to configure this such that the client hostname is correct.
<syntaxhighlight lang="typescript">
<syntaxhighlight lang="typescript">
app.set('trust proxy', 'loopback');
app.set('trust proxy', 'loopback');