request.domain
# => "example.com"
request.host
# => "blog.test.example.com"
request.host_with_port # 取得带端口的主机名
# => "blog.test.example.com:3000"
request.optional_port
# => 3000
request.port
# => 3000
request.port_string
# => ":3000"
request.protocol # 取得当前使用网络协议
# => "http://"
request.raw_host_with_port # 代理服务器的主机名和端口
# => "blog.test.example.com:3000"
request.server_port
# => 3000
request.standard_port # 返回网络协议标准端口(http 为 80, https 为 443)
# => 80
request.standard_port? # 判断当前协议是否是标准端口
# => false
request.subdomain
=> "blog.test"
request.subdomain 2
# => "blog"
request.subdomains
# => ["blog", "test"]
request.subdomains 2
# => ["blog"]
request.url # 取得当前 requset 完整 url
# => "http://blog.test.example.com:3000/users"
extract_domain
extract_subdomain
extract_subdomains
full_url_for
path_for
url_for
env["HTTP_X_FORWARDED_HOST"]
env['HTTP_HOST'], env['SERVER_NAME'], env['SERVER_ADDR'], env['SERVER_PORT']
以及父类 Rack::Request (它也是从 env 里取数据,然后处理。具体不在此描述)