Removing a request header in an access phase handler
Maxim Dounin
mdounin at mdounin.ru
Mon Jul 8 17:59:20 UTC 2013
Hello!
On Mon, Jul 08, 2013 at 06:45:33PM +0200, Jan Algermissen wrote:
> Hi,
>
> I developing a handler for the access phase. In this handler I
> intend to remove a certain header.
>
> It seems that this is exceptionally hard to do - the only hint I
> have is how it is done in the headers_more module.
>
> However, I wonder, whether there is an easier way, given that it
> is not an unusual operation.
Removing request headers from a request isn't something supported
by nginx.
What is supported is filtering/modification of headers passed to
upstream servers with proxy_set_header (fastcgi_param, ...).
E.g., this is how proxy module provies a way to add
X-Forwarded-For header. It implements the $proxy_add_x_forward_for
variable, which is expected to be used in a config like this:
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> If not, I'd greatly benefit from a documentation of the list and
> list-part types. Is that available somewhere? Seems hard to
> figure out all the bits and pieces that one has to go through to
> cleanly remove an element from a list.
Try looking into src/core/ngx_list.[ch] for a documentation in C.
It doesn't really support elements removal though.
--
Maxim Dounin
http://nginx.org/en/donation.html
More information about the nginx
mailing list