# Random 502 Bad Gateway

**URL:** <https://www.ruby-forum.com/t/random-502-bad-gateway/53298>\
**Category:** Rails\
**Created:** [January 31, 2006, 5:51pm UTC](https://www.ruby-forum.com/t/random-502-bad-gateway/53298 "2006-01-31T17:51:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bogdan\_I](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ea666f/32.png) [@Bogdan\_I](https://www.ruby-forum.com/u/Bogdan_I)\
**Post date:** [January 31, 2006, 5:51pm UTC](https://www.ruby-forum.com/t/random-502-bad-gateway/53298/1 "2006-01-31T17:51:55Z")

</div>

I have moved my project to a dedicated server and I am getting a very  
annoying behaviour.  
I am able to view the site just fine when using the ip.  
The name is properly resolved on my computer, however I am getting  
“Bad Gateway The proxy server received an invalid response from an  
upstream  
server.”  
This is simply random. The site works for several minutes, then i get  
this  
message for some time.  
I get nothing in any of the logs, and I get the same behaviour on both  
apache2 and lighttpd.  
Using directly the IP works with no problems at all.

I would really appreciate some clues on how to deal with this (well,  
other  
than getting drunk and forgetting about 😉 )  
Thanks,  
Bogdan

---

<div class="post-metadata">

**Author:** ![Bogdan\_I](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ea666f/32.png) [@Bogdan\_I](https://www.ruby-forum.com/u/Bogdan_I)\
**Post date:** [January 31, 2006, 6:16pm UTC](https://www.ruby-forum.com/t/random-502-bad-gateway/53298/2 "2006-01-31T18:16:16Z")

</div>

On Jan 31, 2006, at 8:50 AM, Bogdan I. wrote:

> Using directly the IP works with no problems at all.
> 
> I would really appreciate some clues on how to deal with this  
> (well, other than getting drunk and forgetting about 😉 )  
> Thanks,  
> Bogdan

Bogdan-

```
I have seen that error before when I was using an apache vhost with

```

proxypass and proxypassreverse to proxy to a lighty server on a high  
port. I have a slight mis-configuration in the proxy vhost and it  
made every request to the server give that same error until I fixed it.

```
Are you using mod_proxy for anything with apache? If so I can send

```

you a good known working vhost to use. Let me know.

Cheers-  
-Ezra Z.  
Yakima Herald-Republic  
WebMaster

> **[yakimaherald.com | Yakima, Washington - We Tell Your Stories](https://www.yakimaherald.com/)**

509-577-7732  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![Bogdan\_I](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ea666f/32.png) [@Bogdan\_I](https://www.ruby-forum.com/u/Bogdan_I)\
**Post date:** [January 31, 2006, 6:31pm UTC](https://www.ruby-forum.com/t/random-502-bad-gateway/53298/3 "2006-01-31T18:31:35Z")

</div>

No, no mod\_proxy. Also I was getting the same thing with lighttpd.  
This seems to somehow be dns related. It appears that the ip of the new  
machine fluctuates randomly.  
The admin of the network hosting the server says everything is alright  
there, but the ip just seems to go back and forth.  
At the same time, i’ve stopped the web server on the original machine,  
and  
the error is still Bad gateway 😛  
Now it seems to be better, so I am hoping that this will fix by itself  
😉

---

<div class="post-metadata">

**Author:** ![Bogdan\_I](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ea666f/32.png) [@Bogdan\_I](https://www.ruby-forum.com/u/Bogdan_I)\
**Post date:** [January 31, 2006, 9:53pm UTC](https://www.ruby-forum.com/t/random-502-bad-gateway/53298/4 "2006-01-31T21:53:34Z")

</div>

r u sure it is not a problem of ur DNS server  
Check with ur hosting company

On 1/31/06, Bogdan I. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > "Bad Gateway The proxy server received an invalid response from an  
> > > Bogdan  
> > > Are you using mod\_proxy for anything with apache? If so I can
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–

Rgds,  
–Siva J.  
[http://www.varcasa.com/](http://www.varcasa.com/)  
My First Rails Project. Powered by Typo and soon by RForum too
