# Need help : Getting 502 response status code for specific URL

**URL:** <https://www.ruby-forum.com/t/need-help-getting-502-response-status-code-for-specific-url/229803>\
**Category:** NGINX\
**Created:** [February 12, 2013, 9:18pm UTC](https://www.ruby-forum.com/t/need-help-getting-502-response-status-code-for-specific-url/229803 "2013-02-12T21:18:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raghvendra\_Parashar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ac8455/32.png) [@Raghvendra\_Parashar](https://www.ruby-forum.com/u/Raghvendra_Parashar)\
**Post date:** [February 12, 2013, 9:18pm UTC](https://www.ruby-forum.com/t/need-help-getting-502-response-status-code-for-specific-url/229803/1 "2013-02-12T21:18:02Z")

</div>

Hi nginx team,

I am getting 502 bad gateway error for particular URL.

Application details :  
Rails 3.1.0  
Ruby 1.9.2  
unicorn 4.2.0  
resque 1.20.0  
nginx/1.0.14  
redis 2.4.8

nginx error log :  
2013/02/12 07:36:16 [error] 32401#0: \*1948 upstream prematurely closed  
connection while reading response header from upstream

I have also posted my question on stack-overflow, please find it  
here[http://stackoverflow.com/questions/14825304/502-error-nginx-ruby-on-rails-application](http://stackoverflow.com/questions/14825304/502-error-nginx-ruby-on-rails-application),  
but couldn’t got any response.

Please guide me to solve this problem.

Thanks  
Regards:  
Raghvendra Kumar Parashar

---

<div class="post-metadata">

**Author:** ![Raghvendra\_Parashar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ac8455/32.png) [@Raghvendra\_Parashar](https://www.ruby-forum.com/u/Raghvendra_Parashar)\
**Post date:** [February 12, 2013, 9:27pm UTC](https://www.ruby-forum.com/t/need-help-getting-502-response-status-code-for-specific-url/229803/2 "2013-02-12T21:27:58Z")

</div>

502 Bad Gateway usually indicates a problem with the application (or  
upstream) server. In this case, I think that would be Unicorn. Double  
check that Unicorn is configured and running and correctly and that the  
port or socket that you have in your nginx config is the same as the  
one Unicorn is listening on.

\_Nik
