# "Proxy proxy"!

**URL:** <https://www.ruby-forum.com/t/proxy-proxy/149573>\
**Category:** NGINX\
**Created:** [September 26, 2008, 12:44pm UTC](https://www.ruby-forum.com/t/proxy-proxy/149573 "2008-09-26T12:44:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![igorclark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/cab0a1/32.png) [@igorclark](https://www.ruby-forum.com/u/igorclark)\
**Post date:** [September 26, 2008, 12:44pm UTC](https://www.ruby-forum.com/t/proxy-proxy/149573/1 "2008-09-26T12:44:03Z")

</div>

Hi,

We have a linux box hosted at an ISP which has been running various  
sites on Apache for some time. I’m in the process of porting the sites  
on it to nginx. At the moment I just have the default (’\_’) nginx  
server proxy\_pass-ing everything to Apache on a local high port like so:

server {  
listen x.x.x.x:80;  
server\_name \_ default;

```
location / {
  proxy_pass http://127.0.0.1:8080;
  proxy_set_header Host $http_host;
  proxy_set_header X-Real-Remote-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

```

}

and I’m just implementing new specific server {} blocks identified  
with server\_name for each site as I go. All the sites work fine, so  
far so good.

The Apache setup is configured to act as a forward proxy, restricted  
to our network and with basic auth, as we occasionally need to check  
how things look from outside our network, or to be able to look back  
at our network from outside.

I’ve added the local address in the Allow from list in the Apache  
proxy config, but I can’t seem to get it to allow proxy requests for  
remote URLs; it just says 403. It allows proxy requests for sites  
hosted on that machine, but nothing else. I’m fairly sure the Apache  
config is otherwise good, as we’ve been using it like this for a while  
and it hasn’t changed other than the new local Allow address.

Perhaps it’s something to do with host-header mangling, or similar …  
Is there a way to get this to work? I guess we could open port 8080 on  
the firewall so that we can access the Apache proxy directly, but I’m  
interested to know if there’s another way.

Thanks,  
Igor

---

<div class="post-metadata">

**Author:** ![igorclark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/cab0a1/32.png) [@igorclark](https://www.ruby-forum.com/u/igorclark)\
**Post date:** [September 26, 2008, 12:56pm UTC](https://www.ruby-forum.com/t/proxy-proxy/149573/2 "2008-09-26T12:56:24Z")

</div>

Hello Igor,

Friday, September 26, 2008, 5:37:28 PM, you wrote:

> Hi,

> We have a linux box hosted at an ISP which has been running various  
> sites on Apache for some time. I’m in the process of porting the sites  
> on it to nginx. At the moment I just have the default (’\_’) nginx  
> server proxy\_pass-ing everything to Apache on a local high port like so:

> ```
> server {
> 
> ```

- 

```
            listen x.x.x.x:80;

```

- 

```
            server_name _ default;

```

- 

```
            listen x.x.x.x:80 default;

```

- 

```
            server_name _;

```

> ```
> location / {
> proxy_pass http://127.0.0.1:8080;
> proxy_set_header Host $http_host;
> 
> ```

- 

```
                    proxy_set_header X-Real-Remote-IP 

```

$remote\_addr;

- 

```
                    proxy_set_header X-Real-IP 

```

$remote\_addr;

> ```
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> }
> }
> 
> ```

> and I’m just implementing new specific server {} blocks identified  
> with server\_name for each site as I go. All the sites work fine, so  
> far so good.

> The Apache setup is configured to act as a forward proxy, restricted  
> to our network and with basic auth, as we occasionally need to check  
> how things look from outside our network, or to be able to look back  
> at our network from outside.

> I’ve added the local address in the Allow from list in the Apache  
> proxy config, but I can’t seem to get it to allow proxy requests for  
> remote URLs; it just says 403. It allows proxy requests for sites  
> hosted on that machine, but nothing else. I’m fairly sure the Apache  
> config is otherwise good, as we’ve been using it like this for a while  
> and it hasn’t changed other than the new local Allow address.

> Perhaps it’s something to do with host-header mangling, or similar …  
> Is there a way to get this to work? I guess we could open port 8080 on  
> the firewall so that we can access the Apache proxy directly, but I’m  
> interested to know if there’s another way.

---

<div class="post-metadata">

**Author:** ![igorclark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/cab0a1/32.png) [@igorclark](https://www.ruby-forum.com/u/igorclark)\
**Post date:** [September 26, 2008, 1:19pm UTC](https://www.ruby-forum.com/t/proxy-proxy/149573/3 "2008-09-26T13:19:55Z")

</div>

Hi Denis, thanks for your suggestions. I tried all these but they  
didn’t make any difference.

(Incidentally X-Real-Remote-IP is used in one of our applications, but  
I tried both with and without, and neither worked.)

Any other thoughts?

Thanks very much,  
Igor

---

<div class="post-metadata">

**Author:** ![igorclark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/cab0a1/32.png) [@igorclark](https://www.ruby-forum.com/u/igorclark)\
**Post date:** [September 26, 2008, 1:21pm UTC](https://www.ruby-forum.com/t/proxy-proxy/149573/4 "2008-09-26T13:21:41Z")

</div>

On piÄ…, wrz 26, 2008 at 12:10:51 +0100, Igor C. wrote:

> Hi Denis, thanks for your suggestions. I tried all these but they  
> didn’t make any difference.
> 
> (Incidentally X-Real-Remote-IP is used in one of our applications, but  
> I tried both with and without, and neither worked.)
> 
> Any other thoughts?

Have you tried mod\_rpaf for apache? It might make a difference.

[http://stderr.net/apache/rpaf/](http://stderr.net/apache/rpaf/)

Best regards,  
Grzegorz N.

---

<div class="post-metadata">

**Author:** ![igorclark](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/cab0a1/32.png) [@igorclark](https://www.ruby-forum.com/u/igorclark)\
**Post date:** [September 26, 2008, 3:49pm UTC](https://www.ruby-forum.com/t/proxy-proxy/149573/5 "2008-09-26T15:49:20Z")

</div>

Thanks Grzegorz, I didn’t know about that, I’ll give it a try.

best  
igor
