generated from nhcarrigan/template
fix: fastify uses lowercase headers
All checks were successful
Node.js CI / Lint and Test (push) Successful in 1m12s
All checks were successful
Node.js CI / Lint and Test (push) Successful in 1m12s
This commit is contained in:
@ -14,7 +14,7 @@ import type { FastifyRequest } from "fastify";
|
|||||||
*/
|
*/
|
||||||
export const getIpFromRequest = (request: FastifyRequest): string => {
|
export const getIpFromRequest = (request: FastifyRequest): string => {
|
||||||
const header
|
const header
|
||||||
= request.headers["X-Forwarded-For"] ?? request.headers["Cf-Connecting-IP"];
|
= request.headers["x-forwarded-for"] ?? request.headers["cf-connecting-ip"];
|
||||||
if (typeof header === "string") {
|
if (typeof header === "string") {
|
||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user