cowboy_req:host(3)

NAME

cowboy_req:host - URI host name

DESCRIPTION
    host(Req :: cowboy_req:req()) -> Host :: binary()

Return the host name of the effective request URI.

The host name can also be obtained using pattern matching:

    #{host := Host} = Req.

ARGUMENTS

Req
    The Req object.

RETURN VALUE

The host name is returned as a lowercase binary string. It is case insensitive.

CHANGELOG
    • 2.0: Only the host name is returned, it is no longer wrapped in a tuple.
    • 1.0: Function introduced.

EXAMPLES

Get the effective request URI's host name
    Host = cowboy_req:host(Req).

SEE ALSO

cowboy_req(3), cowboy_req:binding(3), cowboy_req:bindings(3), cowboy_req:host_info(3)