Mastering Nginx

(Ron) #1

Directive Reference


[ 228 ]

Directive Explanation Context/Default
geo Defines a new context, in which a
variable is set to a specified value,
dependent on the IP address found
in another variable. If no other
variable is specified, $remote_
addr is used to determine the IP
address. The format of the context
definition is:
geo [$address-variable]
$variable-to-be-set { ... }
The following parameters are
recognized within the context:


  • delete: Deletes the
    specified network

  • default: The variable will
    be set to this value if no IP
    address matches

  • include: Includes a file of
    address-to-value mappings

  • proxy: Defines an address
    or network of a direct
    connection from which the
    IP address will be taken
    from the X-Forwarded-
    For header

  • proxy_recursive: Works
    with proxy to specify that
    the last address in a multi-
    valued X-Forwarded-For
    header will be used

  • ranges: When defined,
    indicates that the following
    addresses are specified as
    ranges


Valid context: http
Default value: -
Free download pdf