host()
public
Returns the host for this
request, such as example.com.
class Request < Rack::Request
include ActionDispatch::Http::URL
end
req = Request.new 'HTTP_HOST' => 'example.com:8080'
req.host
# File actionpack/lib/action_dispatch/http/url.rb, line 247
def host
raw_host_with_port.sub(/:\d+$/, ''.freeze)
end