method

port

port()
public

Returns the port number of this request as an integer.

class Request < Rack::Request
  include ActionDispatch::Http::URL
end

req = Request.new 'HTTP_HOST' => 'example.com'
req.port # => 80

req = Request.new 'HTTP_HOST' => 'example.com:8080'
req.port # => 8080