Reverse proxy should send server_name

Francis Daly francis at daoine.org
Tue Nov 22 20:55:31 UTC 2016


On Tue, Nov 22, 2016 at 06:51:28PM +0000, Mik J via nginx wrote:

Hi there,

> location ^~ / {
>          proxy_pass        http://10.1.1.1/service1;And it works but the request appears is if the client typed http://10.1.1.1/service1/ from the web server point of view

> What should I write on the reverse proxy so that the IP paquet is sent to 10.1.1.1 but the HTTP GET request hits the virtual host service1.mydomain.org on the back end web server ?

Either use "proxy_set_header" (http://nginx.org/r/proxy_set_header) to
set Host (and consider "proxy_redirect" too); or create an "upstream"
called service1.mydomain.org and "proxy_pass" to that.

Note that if your "location" ends in /, you probably want your
"proxy_pass" to end in / too.

Cheers,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list