def get_request_ips(request):
    """
    Get the chain of client and proxy IP addresses from the request as
    a nonempty list, where the closest IP in the chain is last. Each
    IP vouches only for the IP before it. This works best if all proxies
    conform the to the X-Forwarded-For header spec, including whatever
    reverse proxy (such as nginx) is directly in front of the app, if any.
    (X-Real-IP and similar are not supported at this time.)
    """
    return request.headers.getlist('X-Forwarded-For') + [request.remote_addr]