Nginx dynamic proxy_pass keeps redirecting to wrong domain

Francis Daly francis at
Thu Nov 16 22:56:06 UTC 2017

On Thu, Nov 16, 2017 at 09:59:49PM +0100, Ruben wrote:

Hi there,

>         location / {
>           proxy_pass http://$instance;
>         }

> The problem is, when I go to in the
> browser, it redirects me to http://instance-001/cdn/test/test.jpg. Which is
> ofcourse not correct. It should proxy the docker service with name
> instance-001.

Are you reporting that nginx creates the redirect, or that nginx passes
along the redirect that the upstream web server creates?

The two cases probably have different fixes.

What do the (nginx and upstream web server) logs say?

Francis Daly        francis at

More information about the nginx mailing list