remix-utils-rt
Version:
This package contains simple utility functions to use with [React Router](https://reactrouter.com/home).
30 lines (29 loc) • 835 B
TypeScript
/**
* Get the IP address of the client sending a request.
*
* It receives the Request object or the headers object and use it to get the
* IP address from one of the following headers in order.
*
* - X-Client-IP
* - X-Forwarded-For
* - HTTP-X-Forwarded-For
* - Fly-Client-IP
* - CF-Connecting-IP
* - Fastly-Client-Ip
* - True-Client-Ip
* - X-Real-IP
* - X-Cluster-Client-IP
* - X-Forwarded
* - Forwarded-For
* - Forwarded
* - DO-Connecting-IP
* - oxygen-buyer-ip
*
* If the IP address is valid, it will be returned. Otherwise, null will be
* returned.
*
* If the header values contains more than one IP address, the first valid one
* will be returned.
*/
export declare function getClientIPAddress(headers: Headers): string | null;
export declare function getClientIPAddress(request: Request): string | null;