elasticsearch/elasticsearch — pull request #2936 by hmalphettes (2013-04-25 16:48:44+00:00)
Title: Set http headers on the response in a java plugin

Taking up the work started by @spinscale in https://github.com/elasticsearch/elasticsearch/pull/2723

"this patch allows to set custom headers in HTTP responses (like setting the WWW-Authenticate header for basic auth) by adding RestRequest.addHeader() method."

The extra hashmap is created lazily so this has no overhead for the core ES requests.
This patch only deals with http-header and has nothing related to redirection.

I hope this helps!