Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce a "TRUST_PROXY" env var that sets Express's "trust proxy" s…
…etting This is for full HTTPS support when a Nuts server sits behind a reverse proxy like NGINX. Often NGINX will accept HTTPS connections and proxy them to a Node server that accepts only HTTP (in this case, the Nuts server). However, we want the Nuts server to recognize that the client made the request over HTTPS. NGINX and other reverse proxies solve this by setting the "X-Forwarded-Proto" header to "https", which Express can access. Express has a setting called "trust proxy" that tells it to use the "X-Forwarded-*" headers as truth when receiving a connection from certain IP addresses (this is configurable; see http://expressjs.com/en/guide/behind-proxies.html). So by exposing the "trust proxy" setting via an env var (`TRUST_PROXY`), people can run Nuts servers behind NGINX and Nuts will produce HTTPS URLs instead of HTTP ones.
- Loading branch information