edx/configuration — pull request #903 by mtyaka (2014-03-21 19:58:50+00:00)
Title: NginxX-Forwarded-For header configuration.

The nginx configuration was set to pass `X-Forwarded-For` and related headers
unmodified to backend services.
This works fine when nginx is deployed behind another load balancer
(for example ELB), which already properly sets the `X-Forwarded-*` for headers.

But in simpler deployment scenarios, where nginx is directly facing the end user,
nginx should discard any existing `X-Forwarded-For` header and set it to remote IP of the request,
the `X-Forwarded-Port` header to the nginx server port, and the `X-Forwarded-Proto`
to the scheme of the current request.

The behavior is controlled by the `nginx_set_x_forwarded_headers` configuration variable.
When set to False, nginx will forward existing X-Forwarded-* unmodified.
When set to True, nginx will discard any existing `X-Forwarded-*` headers and set them itself.

`nginx_set_x_forwarded_headers` is set to `False` by default, but set to `True` in the `edx_sandbox` playbook, where nginx is usually not deployed behind another load balancer.

The variable name is probably not ideal and I would welcome any better suggestions.