# Nginx forward proxy - 502 bad gateway

**URL:** <https://www.ruby-forum.com/t/nginx-forward-proxy-502-bad-gateway/227269>\
**Category:** NGINX\
**Created:** [March 9, 2013, 6:17pm UTC](https://www.ruby-forum.com/t/nginx-forward-proxy-502-bad-gateway/227269 "2013-03-09T18:17:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Panagiotis\_Theodoro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/58f4c7/32.png) [@Panagiotis\_Theodoro](https://www.ruby-forum.com/u/Panagiotis_Theodoro)\
**Post date:** [March 9, 2013, 6:17pm UTC](https://www.ruby-forum.com/t/nginx-forward-proxy-502-bad-gateway/227269/1 "2013-03-09T18:17:51Z")

</div>

I have install nginx forward proxy in two Ubuntu 12.04 servers with the  
following configuration.

server {  
listen 8080;

location / {  
resolver 8.8.8.8;  
proxy\_pass http://$http\_host$uri$is\_args$args;  
}  
}

After this I use the two servers as proxy on firefox.  
The one server works fine.

But on the second server I get the message 502 bad gateway.

This server is behind a cisco firewall with port 8080 open. Where is the  
problem?

The line:

proxy\_pass http://$http\_host$uri$is\_args$args;

has problem with firewalls? or it is something else?

---

<div class="post-metadata">

**Author:** ![Panagiotis\_Theodoro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/58f4c7/32.png) [@Panagiotis\_Theodoro](https://www.ruby-forum.com/u/Panagiotis_Theodoro)\
**Post date:** [March 9, 2013, 7:29pm UTC](https://www.ruby-forum.com/t/nginx-forward-proxy-502-bad-gateway/227269/2 "2013-03-09T19:29:42Z")

</div>

> 

are you able to connect to $http\_host from that second server,  
maybe via lynx/w3m?  
$ telnet $http\_host 8080

and then

GET /

additionally, can you execute the following on that  
server to check if you’re able to connect to your resolver:

$ nslookup $http\_host 8.8.8.8

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,237162,237164#msg-237164](http://forum.nginx.org/read.php?2,237162,237164#msg-237164)
