Skip to content

fastify/forwarded

Folders and files

NameName
Last commit message
Last commit date

Latest commit

2cb007d · Mar 30, 2025
Mar 30, 2025
Jul 7, 2022
Aug 7, 2024
Dec 16, 2024
Feb 8, 2024
Jul 7, 2022
Feb 12, 2021
Feb 3, 2025
Dec 8, 2024
Jan 9, 2025
Dec 22, 2024

Repository files navigation

@fastify/forwarded

CI NPM version neostandard javascript style

Parse HTTP X-Forwarded-For header.

Updated version of the great https://github.com/jshttp/forwarded. Implements jshttp/forwarded#9.

Installation

$ npm i @fastify/forwarded

API

const forwarded = require('@fastify/forwarded')

forwarded(req)

const addresses = forwarded(req)

Parse the X-Forwarded-For header from the request. Returns an array of the addresses, including the socket address for the req, in reverse order (i.e. index 0 is the socket address and the last index is the furthest address, typically the end-user).

Testing

$ npm test

License

MIT