(
req: Pick<express.Request, "headers" | "socket">
)
| 890 | }); |
| 891 | |
| 892 | function getRequestIpAddress( |
| 893 | req: Pick<express.Request, "headers" | "socket"> |
| 894 | ): string | undefined { |
| 895 | const forwardedFor = getFirstHeaderValue(req, "x-forwarded-for"); |
| 896 | if (forwardedFor) { |
| 897 | const first = forwardedFor.split(",")[0]?.trim(); |
| 898 | if (first) { |
| 899 | return first; |
| 900 | } |
| 901 | } |
| 902 | |
| 903 | const remoteAddress = req.socket.remoteAddress?.trim(); |
| 904 | return remoteAddress?.length ? remoteAddress : undefined; |
| 905 | } |
| 906 | |
| 907 | function isSecureRequest(req: OriginValidationRequest): boolean { |
| 908 | return getPreferredPublicProtocol(req, allowHttpOrigin) === "https"; |
no test coverage detected