﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
681	Pass custom Host in upstream module	Aleš Kafka		"Currently, proxy_pass via upstream sends $host resolved in server_name or user-defined. This is usually good enough solution, but sometimes it's not, as I have experienced and I found other users having trouble with this too.

Use case is this:
You have multiple servers serving content. This could be VPS, dedicated servers, but also shared hostings. Problem is, that you can't configure shared hosting to server same content under two different hosts (original www.example.com and from proxy proxy-example.com). It routes to different folder. Now you want to use one proxy server to serve content from all those servers.

Solution is very easy:
extends server directive in upstream module to allow specifying host.

{{{
upstream example {
    server 1.2.3.4:80 host=www.example.com;
    server 1.2.3.3:80 host=www.example2.com;
}
}}}

when server 1.2.3.4:80 is chosen, it send header Host www.example.com; when server 1.2.3.3:80, it sends www.example2.com; if host is not specified, it sends Host resolved from server_name or specified with proxy_pass_header. "	enhancement	closed	minor		nginx-module	1.7.x	wontfix	upstream, host			"nginx version: nginx/1.6.2
built by clang 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
TLS SNI support enabled
configure arguments: --prefix=/usr/local/Cellar/nginx-full/1.6.2 --with-http_ssl_module --with-pcre --with-ipv6 --sbin-path=/usr/local/Cellar/nginx-full/1.6.2/bin/nginx --with-cc-opt='-I/usr/local/include -I/usr/local/Cellar/pcre/8.35/include -I/usr/local/Cellar/openssl/1.0.1h/include' --with-ld-opt='-L/usr/local/lib -L/usr/local/Cellar/pcre/8.35/lib -L/usr/local/Cellar/openssl/1.0.1h/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/usr/local/var/run/nginx.pid --lock-path=/usr/local/var/run/nginx.lock --http-client-body-temp-path=/usr/local/var/run/nginx/client_body_temp --http-proxy-temp-path=/usr/local/var/run/nginx/proxy_temp --http-fastcgi-temp-path=/usr/local/var/run/nginx/fastcgi_temp --http-uwsgi-temp-path=/usr/local/var/run/nginx/uwsgi_temp --http-scgi-temp-path=/usr/local/var/run/nginx/scgi_temp --http-log-path=/usr/local/var/log/nginx/access.log --error-log-path=/usr/local/var/log/nginx/error.log --with-http_spdy_module --add-module=/usr/local/share/echo-nginx-module"
