[Mongrel] Finding out on which port mongrel is running

Maximilian Schoefmann schoefma at cip.ifi.lmu.de
Mon Aug 7 03:32:01 EDT 2006

>>>> Yes, this would be an option. Unfortunately I would loose the
>>>> possibility
>>>> to use the nice mongrel_cluster gem to manage my cluster (maybe
>>>> this would
>>>> be a useful addition to mongrel_cluster).
>>> The port is included in the name of the pid file. Could you just
>>> parse it from the file name?
>> yes, that's what I'm in fact doing now :-)
>> But I have to open every file matching the mongrel.<portnumber>.pid
>> pattern and check if the stored pid matches the current pid.
>> ... not the most elegant solution :-/ but it works
> We have the exception_notification plugin which emails us when there is a
> rails error... in that email we get the following:
>    * URL:
> I just checked a couple of them and that :8004 changes to whatever the
> port is that is that mongrel.  Digging through the code for the plugin I
> see this in a view:
> * URL: <%= @request.protocol %><%= @host %><%= @request.request_uri %>
> and this in a lib:
> :exception => exception, :host => request.env["HTTP_HOST"],
> We're using apache 2.2 and mongrel 0.3.13....
> So it's gettable...

I'm sure Apache 2.2/mod_proxy_balancer does a better job in forwarding the
correct port to rails. Unfortunately I'm doomed to Apache 2.0 / Pen here.
But good to know.

More information about the Mongrel-users mailing list