Nginx dynamic proxy_pass keeps redirecting to wrong domain

Peter Booth peter_booth at
Fri Nov 17 03:55:26 UTC 2017

You need to understand, step-by-stp, exactly what is happening.
Here is one (of many) ways to do this:

1. Open the Chrome browser 
2. Right click on the background and select inspect, this will open the developer tools page
3. Select the tab “Network” which shows you the HTTp requests issued for the current page. 
4. Select the check-box preserve log which means that prior pages will still be shown here when you are redirected to another page
5. Now open the URL in question. You will see the response from nginx which should, if you are correctly reporting what happens have a 301 or 302 code

alternately you can do this from a linux or OS X command line using curl or wget

> On Nov 16, 2017, at 10:48 PM, Ruben D <rdocter at> wrote:
> In my browser bar I see the address beginning with instance-001. While I expect not to have a redirect and just see
> Is that what you mean?
> Verstuurd vanaf mijn iPhone
>> Op 16 nov. 2017 om 23:56 heeft Francis Daly <francis at> het volgende geschreven:
>> 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?
>>   f
>> -- 
>> Francis Daly        francis at
>> _______________________________________________
>> nginx mailing list
>> nginx at
> _______________________________________________
> nginx mailing list
> nginx at

More information about the nginx mailing list