I’ve been using pound for several months and it’s been a good relationship. Except, for some strange reason, I noticed that I was getting development mode errors when it was running in production mode. I thought there might be an issue with my mongrel cluster… but that wasn’t the case.
Let me give you a little background to how we’re encouraging customers to handle their deployment on PLANET ARGON.
Most of our hosting customers[^1^](#fn1){#fnref1 .footnote-ref role=”doc-noteref”} have three tiers (unless you have your own static IP address), one which we manage, two that you manage.
We handle the main web server/proxy server and proxy to your desired load balancer/proxy/server, which is generally any of the following options… depending on your preference.
Each customer has a unique proxy server port and a range of other ports for their mongrel clusters.
So… the typical setup is…
Apache(external:80) [proxies to]> Pound(localhost:8050) [proxies to]> Mongrel::Cluster(localhost:10500-10503)
Well, when a request comes in through Apache, it gets passed off to
Pound and each tier has it’s own headers. By the time that it reaches
Mongrel, all the requests appear to be coming from localhost
.. not
the remote address of the person using your application. Notice nothing
but localhost
requests in your production.log? …this is the reason.
So, what side-effects does this have? Well, aside from every request
looking local… Rails will, by default, output a normal
development-mode error message if the request is coming from
localhost
.
```text
# found in...
# actionpack/lib/action_controller/rescure.rb
# Exception handler called when the performance of an action raises an exception.
def rescue_action(exception)
log_error(exception) if logger
erase_results if performed?
if consider_all_requests_local || local_request?
rescue_action_locally(exception)
else
rescue_action_in_public(exception)
end
end
It seems that this currently causes the [exception
notification](http://dev.rubyonrails.org/svn/rails/plugins/exception_notification/)
plugin, which we often use, to not work. We noticed this in a staging
environment for an application that we're building for a client about a
month ago. After debugging SMTP servers, mongrel configuration... I was
baffled.
## Nginx to the `rescue`
After some investigation and attempts to find a workaround in Pound, I
decided to redeploy my blog with Nginx. This was a pretty painless
process and I was able to use [the
example](http://docs.planetargon.com/wiki/show/Setup+Nginx) posted on
the [PLANET ARGON Documentation Project](http://docs.planetargon.com/).
Nginx allows you to do the following to overwrite the headers being
passed to Mongrel.
```text
```css
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
**Problem Solved!**
If there is a workaround for this in Pound, I'd love to be able to relay
this information to our customers that haven't made the switch yet.
Thank you, [Brian](http://blog.brightredglow.com) and
[Timothy](http://workingwithrails.com/person/7552) for encouraging me to
finally switch my blog to Nginx. ;-)
If you have questions related to deploying Rails applications, be sure
to check out the [Rails Deployment google
group](http://groups.google.com/group/rubyonrails-deployment/about).
------------------------------------------------------------------------
1. ::: {#fn1}
```yaml
For more information about our hosting, visit
[http://planetargon.com/hosting.html](http://www.planetargon.com/hosting.html).[↩︎](#fnref1){.footnote-back
role="doc-backlink"}
:::