Nginx redirect preserving source hostname

Francis Daly francis at
Tue Apr 4 21:10:11 UTC 2017

On Mon, Apr 03, 2017 at 02:17:19PM +0600, Игнатенко Максим wrote:

Hi there,

> I have an NGINX as reverse proxy with PHP-fpm. Nginx is set up for
> serving I added another host
> Now I need to setup redirect in this way: If user type
> then it redirects to,
> but url in browser bar shouldn't change.

> Is it possible to redirect preserving url ?

A "redirect" is an "external rewrite", which asks the browser to make
a new request, and therefore change the url the browser shows.

If you want the browser not to make a new request, you need to handle
the request internally, within nginx, possibly by means of a proxy_pass
(if the desired resource is only available in another server{}).

Good luck with it,

Francis Daly        francis at

More information about the nginx mailing list