RoR, lighttpd, and localhost

This is really more of a web server configuration question, but it
seemed
like a problem in which RoR’ers would be well versed.

I am running a RoR app on lighttpd behind an Apache proxy (well, reverse
proxy is perhaps more accurate).

Since the requests are being proxied to Lighttpd from the same server,
my
Rails apps think that the requests are coming from localhost. As such,
anytime an error is encountered in the Rails app, I get the “development
mode” style verbose errors, instead of the production friendly ones.

Does anyone know how to fix this? I have preserve host headers turned
on,
which I thought would’ve fixed it, but it does not. Ideally this would
be a
fix on the web server side as I am also experiencing a similar problem
with
a PHP app running on the same lighttpd server, but I’ll take anything I
can
get. Any suggestions?

Matt

Belorion wrote:

This is really more of a web server configuration question, but it
seemed
like a problem in which RoR’ers would be well versed.

I am running a RoR app on lighttpd behind an Apache proxy (well, reverse
proxy is perhaps more accurate).

Since the requests are being proxied to Lighttpd from the same server,
my
Rails apps think that the requests are coming from localhost. As such,
anytime an error is encountered in the Rails app, I get the “development
mode” style verbose errors, instead of the production friendly ones.

Does anyone know how to fix this? I have preserve host headers turned
on,
which I thought would’ve fixed it, but it does not. Ideally this would
be a
fix on the web server side as I am also experiencing a similar problem
with
a PHP app running on the same lighttpd server, but I’ll take anything I
can
get. Any suggestions?

Matt

I think that when I set up my Apache proxy for my textdrive account,
instead of forwarding to localhost:other_port it worked better if you
forward to yourdomain.com:other_port.

Also, are you sure that its giving you these errors because of host
issues, and not because you’re in development mode rather than
production?

I think that when I set up my Apache proxy for my textdrive account,
instead of forwarding to localhost:other_port it worked better if you
forward to yourdomain.com:other_port.

It depends on how you define “works better”. The problem with setting
the
proxy for yourdomain.com:otherport is that Apache then has to do a DNS
lookup. This seems to cause severe response delays (at least last time
I
tried it).

Also, are you sure that its giving you these errors because of host

issues, and not because you’re in development mode rather than
production?

Well, I have it set to production mode in my config/environment.rb …
so
unless something changed in 1.1 I assume this is where it is getting
set.

-Matt