Editing headers in both directions

Maxim Dounin mdounin at mdounin.ru
Mon Mar 29 15:09:42 MSD 2010


Hello!

On Mon, Mar 29, 2010 at 12:23:56PM +0200, Toni Mueller wrote:

> after digging deeper into my Domino problem, I found that I should be
> able to edit both incoming and outgoing headers, eg. to cut out the
> domain part of said cookie (reconfiguring the server is a no-go), and
> adding the part back in later when the client sends the modified cookie
> back, so the Domino server can properly recognize the cookie.
> 
> I'd like to say something like
> 
> rewrite_header <headername> <direction> ...
> 
> where "..." is the same stuff as in the "rewrite" directive.
> 
> I've started taking a close look at ngx_http_rewrite_module.c, but
> after reading some here
> http://www.evanmiller.org/nginx-modules-guide.html, I found that I'm
> most likely going down the wrong path. At least, I don't see how the
> functionality I want fits into Evan's taxonomy of "handler", "filter",
> and "upstream" modules.
> 
> Some guidance would be MUCH appreciated!

You have to implement:

1. Rewriting of outgoing headers via header filter.  This should 
be more or less trivial, see various header filters for examples, 
e.g. src/http/modules/ngx_http_headers_filter_module.c.

2. Rewriting of incoming headers.  This may be done via variable 
and something like

    proxy_set_header Cookie $your_variable_with_rewritten_cookie;

in config (like it's done with X-Forwarded-For and 
$proxy_add_x_forwarded_for variable).

Maxim Dounin



More information about the nginx mailing list