Determining what mongrel port a request is serviced by

Hi folks,

We’re using mongrel_cluster for our app. For debugging purposes, we’d
like to determine which mongrel port an individual request is being
serviced by.

This code:

def host_port
    @request.host + ":" + @request.port.to_s
end

returns

1.2.3.4:80

What I’d like is this, for example

1.2.3.4:8004

Any thoughts?

Carpe viam,
Mike

Michael Larocque
Chief Cook and Bottle Washer
Prolumina Communications Inc.
http://prolumina.com/~mlarocque/

returns

1.2.3.4:80

What I’d like is this, for example

1.2.3.4:8004

Any thoughts?

We run mongrel behind apache 2.2 and for us ENV[SERVER_PORT] is set to
the
port that mongrel is listening on. I haven’t verified this, but we have
that exception notifier plugin that emails when an error has occured and
in that email it prints out the environment and that’s what it says.

  • SERVER_NAME : 127.0.0.1
  • SERVER_PORT : 8002
  • SERVER_PROTOCOL : HTTP/1.1
  • SERVER_SOFTWARE : Mongrel 0.3.13.3

-philip