Handler invokation after upstream server being picked

Maxim Dounin mdounin at mdounin.ru
Fri Oct 25 14:06:47 UTC 2013


On Fri, Oct 25, 2013 at 12:30:34PM +0200, Jan Algermissen wrote:

> Hi,
> I am writing a module that needs to add/change the HTTP 
> Authorization server for an upstream request.
> Since I am using a signature based authentication scheme where 
> the signature base string includes the request host and port the 
> header can only be added *after* the upstream module has 
> determined which server to send the request to (e.g. after 
> applying round-robin).
> Is it possible to hook my module into that 'phase' and if so - 
> what is the preferred way to do that?
> I saw that I at least can access the target host and port set by 
> the proxy module by reading the proxy module variables. However, 
> that (of course) does only give the server group name to be used 
> by the upstream module in the next step.

A request to an upstream is created once, before a particular 
server is known, and the same request is used for requests to all 
upstream servers.  That is, what you are trying to do isn't 
something currently possible.

Maxim Dounin

More information about the nginx mailing list