# Proxy\_bind doesn't work outside location

**URL:** <https://www.ruby-forum.com/t/proxy-bind-doesnt-work-outside-location/215173>\
**Category:** NGINX\
**Created:** [December 25, 2011, 9:16am UTC](https://www.ruby-forum.com/t/proxy-bind-doesnt-work-outside-location/215173 "2011-12-25T09:16:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [December 25, 2011, 9:16am UTC](https://www.ruby-forum.com/t/proxy-bind-doesnt-work-outside-location/215173/1 "2011-12-25T09:16:57Z")

</div>

Hi

I don’t know if this is appropriate place or not but there is a bug with  
proxy\_bind, the directive has to be inside a location to work. I’m sure  
this wasn’t true for early versions.  
so this won’t work:  
proxy\_bind 1.7.2.109;  
location /test {  
.  
.  
.  
proxy\_pass …;  
}

while this does

```
    location /test {
    .
    .
    .
    proxy_bind 1.7.2.109;
    proxy_pass ...;
   }

```

nginx version: nginx/1.1.8  
TLS SNI support enabled  
configure arguments: --prefix=/etc/nginx  
–conf-path=/etc/nginx/nginx.conf  
–error-log-path=/var/log/nginx/error.log --http-client-body-temp  
-path=/var/lib/nginx/body  
–http-fastcgi-temp-path=/var/lib/nginx/fastcgi  
–http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/  
var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi  
–http-uwsgi-temp-path=/var/lib/nginx/uwsgi  
–lock-path=/var/lock/nginx.lock -  
-pid-path=/var/run/nginx.pid --with-debug --with-http\_addition\_module  
–with-http\_dav\_module --with-http\_geoip\_module --with-http\_gzip\_stati  
c\_module --with-http\_image\_filter\_module --with-http\_realip\_module  
–with-http\_stub\_status\_module --with-http\_ssl\_module  
–with-http\_sub\_mod  
ule --with-http\_xslt\_module --with-ipv6 --with-sha1=/usr/include/openssl  
–with-md5=/usr/include/openssl --with-mail --with-mail\_ssl\_module  
–add-module=/root/nginx/nginx-1.1.8/debian/modules/nginx-echo  
–add-module=/root/nginx/nginx-1.1.8/debian/modules/nginx-upstream-fair

Thanks

Posted at Nginx Forum:

> **[proxy\_bind doesn't work outside location](https://forum.nginx.org/read.php?2,220457,220457#msg-220457)**
>
> Hi I don't know if this is appropriate place or not but there is a bug with proxy\_bind, the directive has to be inside a location to work. I'm sure this wasn't true for early versions. so this won't work: proxy\_bind 1.7.2.109; location /test {

---

<div class="post-metadata">

**Author:** ![mojiz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a87d85/32.png) [@mojiz](https://www.ruby-forum.com/u/mojiz)\
**Post date:** [December 25, 2011, 12:40pm UTC](https://www.ruby-forum.com/t/proxy-bind-doesnt-work-outside-location/215173/2 "2011-12-25T12:40:57Z")

</div>

Hello!

On Sun, Dec 25, 2011 at 03:16:25AM -0500, mojiz wrote:

> I don’t know if this is appropriate place or not but there is a bug with  
> proxy\_bind, the directive has to be inside a location to work. I’m sure  
> this wasn’t true for early versions.

Yes, it’s the bug. Thank you for report.

The bug was always here, since appearence of the proxy\_bind  
directive. Here is the trac ticket for it:

> **[\#40 (proxy\_bind inheritance)
          – nginx](https://trac.nginx.org/nginx/ticket/40)**

Maxim D.

---

<div class="post-metadata">

**Author:** ![mojiz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a87d85/32.png) [@mojiz](https://www.ruby-forum.com/u/mojiz)\
**Post date:** [December 26, 2011, 3:08am UTC](https://www.ruby-forum.com/t/proxy-bind-doesnt-work-outside-location/215173/3 "2011-12-26T03:08:49Z")

</div>

Maxim,

Is it possible to also merge the patch that proxy\_bind support  
variables when you fix this issue?  
Thanks in advance.

BR,  
DeltaY

2011/12/25 Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![mojiz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a87d85/32.png) [@mojiz](https://www.ruby-forum.com/u/mojiz)\
**Post date:** [December 26, 2011, 11:38am UTC](https://www.ruby-forum.com/t/proxy-bind-doesnt-work-outside-location/215173/4 "2011-12-26T11:38:28Z")

</div>

Hello!

On Mon, Dec 26, 2011 at 10:08:00AM +0800, Delta Y. wrote:

> Maxim,
> 
> Is it possible to also merge the patch that proxy\_bind support  
> variables when you fix this issue?

Yes. I would like to rewrite the patch though, so it may take  
some time.

Maxim D.
