> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Parse Forwarded For • AI Agent SDK

> parse_forwarded_for: Parse an ``X-Forwarded-For`` header into an ordered list of hops.

# parse\_forwarded\_for

Function

> This function is defined in the [**protocols**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/protocols.md) module.

Parse an `X-Forwarded-For` header into an ordered list of hops.

The chain is left→right, client-first: `client, proxy1, proxy2`. Empty
tokens and surrounding whitespace are dropped; `None`/empty yields an
empty list. Pure string handling — no name resolution, no validation of
whether each token is a real IP (that is the caller's trust decision).

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def parse_forwarded_for(header: Optional[str]) -> 'List[str]'
```

## Parameters

**header** `Optional[str]` *required*

No description available.

### Returns

**Returns** `'List[str]'`

The result of the operation.

## Source

> **[View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/gateway/protocols.py#L2620)**
>
> `praisonaiagents/gateway/protocols.py` at line 2620


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.