# Nginx not reverse proxying correctly

**URL:** <https://www.ruby-forum.com/t/nginx-not-reverse-proxying-correctly/229830>\
**Category:** NGINX\
**Created:** [February 15, 2013, 3:34pm UTC](https://www.ruby-forum.com/t/nginx-not-reverse-proxying-correctly/229830 "2013-02-15T15:34:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![antoinebk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7ab992/32.png) [@antoinebk](https://www.ruby-forum.com/u/antoinebk)\
**Post date:** [February 15, 2013, 3:34pm UTC](https://www.ruby-forum.com/t/nginx-not-reverse-proxying-correctly/229830/1 "2013-02-15T15:34:43Z")

</div>

Hello,

I come seeking your help because I have a problem that I have been  
unable to  
solve using the classic Internet resources.

Currently, we have an Apache2 webserver acting as load balancer for our  
web  
architecture. The backends are Xen virtual machines accessible via IPv6  
for  
the public Internet and via IPv4 for our VPN. The problem is that the  
Apache  
2 loadbalancer doesn’t perform as well as we would like it to so we’re  
switching to nginx.

The version of nginx installed is 1.3.10 which was compiled with  
standard  
Debian options. We had to go for this version because it was the only  
one  
that supports IPv6 backends which is a requirement for these VMs. For  
the  
moment, nginx only has one “virtual host” or server block and it is the  
following.

```
upstream backend-cookissime-prod {
  server cookissime-prod.cookissime1.vm.cob:80 max_fails=5;
  server cookissime-prod.cookissime2.vm.cob:80 max_fails=5;
}

server {
  listen 37.59.6.220:80;
# listen [::]:80;
  server_name www.cookissime.fr;

  access_log /var/log/nginx/cookissime-prod.log;
  error_log /var/log/nginx/cookissime-prod.log;

  ## send request back to apache1 ##
  location / {
    proxy_pass http://backend-cookissime-prod;
    proxy_next_upstream error timeout invalid_header http_500 

```

http\_502  
http\_503 http\_504;  
proxy\_redirect off;  
proxy\_buffering off;  
proxy\_set\_header Host $host;  
proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For  
$proxy\_add\_x\_forwarded\_for;  
}  
}

There is also a second code block which takes the above information and  
replaces prod with dev. The domain names  
cookissime-prod.cookissime1.vm.cob  
and cookissime-prod.cookissime2.vm.cob resolve to an IPv6 on our  
internal  
DNS.

The above configuration seems to be good syntax-wise. The problem is  
that  
most of the time, this configuration displays the default “Welcome to  
nginx”  
page but sporadically it will display the website for a few minutes then  
return to the default page.

This very setup works correctly with Apache2 so the virtual machines are  
functionnal.

What am I missing ? What could cause these problems ?

Thank you in advance for your help,

Antoine Benkemoun

Posted at Nginx Forum:

> **[nginx not reverse proxying correctly](https://forum.nginx.org/read.php?2,236230,236230#msg-236230)**
>
> Hello, I come seeking your help because I have a problem that I have been unable to solve using the classic Internet resources. Currently, we have an Apache2 webserver acting as load balancer for our web architecture. The backends are Xen virtual...
