> For the complete documentation index, see [llms.txt](https://xoops.gitbook.io/xmf-cookbook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xoops.gitbook.io/xmf-cookbook/reference/proxycheck.md).

# ProxyCheck

`Xmf\ProxyCheck` handles proxy detection for `Xmf\IPAddress`

*Note: There is normally no direct use of this class outside of Xmf\IPAddress.*

If your XOOPS system runs behind a proxy such as a load balancer, by default [Xmf\IPAddress](/xmf-cookbook/reference/ipaddress.md) will return the address of your proxy, not the client address.

To have IPAddress use ProxyCheck to report the client IP, establish a proxy\_env key in *xoops\_data/configs/xoopsconfig.php* that reflects the header name your proxy is configured to use to indicate the IP address of client that initiated the current request. Note that the value expected is the PHP $\_SERVER variable key set to hold that header, not the actual HTTP header name.

Example for [RFC 7239](https://tools.ietf.org/html/rfc7239):

`'proxy_env' => 'HTTP_FORWARDED',`

Example for the common Client-IP header:

`'proxy_env' => 'HTTP_CLIENT_IP',`

Example for the common X-Forwarded-For header:

`'proxy_env' => 'HTTP_X_FORWARDED_FOR',`

If the $\_SERVER key specified in `proxy_env` exists, the IP address specified in that header will be used by `Xmf\IPAddress` if it is valid and routable.

**Note:** This class is intended to be used only with a proxy you (or your hosting) control that sets the header you specifed. That proxy should also NOT forward to you any proxy related headers it did not set. Relying on the IP address in any other context, such as trying to peer behind a client side proxy, raises **serious security concerns**.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://xoops.gitbook.io/xmf-cookbook/reference/proxycheck.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
