@request.env and mongrel

Hi,

I don’t know if this question should be posted here on the Rails list or
the Mongrel list, but I’ll try here first. I had been using
Aapache+FCGI and when I run the following code from my server’s domain
perficient.com” it returns “perficient.com:80”:

port = @request.env[“SERVER_PORT”]==‘80’ ? ‘’ :
“:#{@request.env[“SERVER_PORT”]}”
server = “http://#{@request.env[“SERVER_NAME”]}#{port}”

however when I use Apache+Mongrel it returns “localhost:3000”.

Any ideas? if not is there another method I could call to get the true
server domain and port that the original request came to?

Thanks in advance. Scott.


What’s an Intel chip doing in a Mac? A whole lor more that it’s ever
done in a PC.

My Digital Life - http://scottwalter.com/blog
Pro:Blog - http://scottwalter.com/problog
Snippets - http://snippets.scottwalter.com

On Fri, 2006-06-23 at 05:57 -0700, Scott W. wrote:

however when I use Apache+Mongrel it returns “localhost:3000”.

Any ideas? if not is there another method I could call to get the
true server domain and port that the original request came to?

Depends, if you just want to get the host:port that the client thinks
it’s connecting to then you’ll want to use “HOST”. If you need the
host:port that Mongrel is running on for some kind admin thing then
it’s running on localhost:3000 and there’s not a whole that can be
done unless you change the port and address on the command line (do
mongrel_rails start -h).


Zed A. Shaw

http://mongrel.rubyforge.org/