[PATCH] Add support for uwsgi host and port variables

Maxim Dounin mdounin at mdounin.ru
Sun Jan 8 13:20:20 UTC 2012


Hello!

On Fri, Jan 06, 2012 at 05:44:35PM -1000, Derrick Petzold wrote:

> Hello,
> 
> I added support for setting the following variables:
> 
> uwsgi_host - The host and port of the uwsgi server that handled the request.
> uwsgi_port - The port of the uwsgi server that handled the request.

Just a side note: this is incorrect definition, $proxy_host is a 
host/port as written in the proxy_pass directive, not a "server 
that handled the request".

To list servers used to handle a request the $upstream_addr 
variable is available, see here:

http://nginx.org/en/docs/http/ngx_http_upstream_module.html#variables

> They are modeled after the proxy_host and proxy_port variables. (I
> shamelessly copied that code). The major change is that the uwsgi
> module now has its own context structure whereas before it was using
> ngx_http_status_t. Please let me know if you have any questions or
> comments.

The main reason why $proxy_host exists is that it's needed to 
create correct http request with a Host header from a proxy_pass 
directive.  It's mostly internal variable.  Why this is 
needed for uwsgi (and not fastcgi/scgi)?

Maxim Dounin



More information about the nginx-devel mailing list