# Bad root document set via proxy\_pass

**URL:** <https://www.ruby-forum.com/t/bad-root-document-set-via-proxy-pass/245414>\
**Category:** NGINX\
**Created:** [May 30, 2013, 6:14pm UTC](https://www.ruby-forum.com/t/bad-root-document-set-via-proxy-pass/245414 "2013-05-30T18:14:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [May 30, 2013, 6:14pm UTC](https://www.ruby-forum.com/t/bad-root-document-set-via-proxy-pass/245414/1 "2013-05-30T18:14:36Z")

</div>

Hello everybody,

I am using several instances of Nginx (1.4.1). One as a LoadBalancer and  
the  
others to host rails applications (using module passenger).

Depending of the url, I forward to the proper backend:  
location / {  
proxy\_pass http://\_cluster;  
}

But via the proxy, the web page of my application is not correctly  
render.  
The path to load images files is incorrect and point to the default root  
document location.

Direct access to my application is fine so I guess I miss something in  
the  
load balancer configuration but what ?  
Before that when I didn’t need to precise the url in the location  
directive,  
it worked fine via the load balancer as well.

Cheers,  
Mat.

Posted at Nginx Forum:

> **[\[LB\]Bad root document set via proxy\_pass](https://forum.nginx.org/read.php?2,239702,239702#msg-239702)**
>
> Hello everybody, I am using several instances of Nginx (1.4.1). One as a LoadBalancer and the others to host rails applications (using module passenger). Depending of the url, I forward to the proper backend: location /\<myApp\> { proxy\_pass...

---

<div class="post-metadata">

**Author:** ![mafious](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/13edae/32.png) [@mafious](https://www.ruby-forum.com/u/mafious)\
**Post date:** [June 1, 2013, 11:25am UTC](https://www.ruby-forum.com/t/bad-root-document-set-via-proxy-pass/245414/2 "2013-06-01T11:25:22Z")

</div>

On Thu, May 30, 2013 at 12:14:09PM -0400, mafious wrote:

Hi there,

> Depending of the url, I forward to the proper backend:  
> location / {  
> proxy\_pass http://\_cluster;  
> }
> 
> But via the proxy, the web page of my application is not correctly render.  
> The path to load images files is incorrect and point to the default root  
> document location.

I’m not exactly sure what you are reporting.

Is it that your application writes links like “/images/image.png”  
instead  
of “/myapp/images/image.png”? (In which case: fix your application.)

Or is it that your application writes links like  
“/myapp/images/image.png”  
and you want the load balancer to serve them from somewhere else? (In  
which case: fix your load-balancer config.)

Or is it something else?

The more specific you are with reports like “I do this, I see this,  
I expect to see this”, the more chance that someone will be able to  
help.

Good luck,

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
