Updated: 28 September 2026 · Applies to: cPanel & WHM 138 (EasyApache 4, AlmaLinux 9)

When a website runs behind a proxy or CDN (for example Cloudflare, or cPanel's own NGINX reverse proxy), Apache sees the proxy's IP instead of the visitor's. mod_remoteip restores the real visitor IP from a header, for logs.htaccess rules and applications.

1. Install

In WHM, Software › EasyApache 4 › Customize › Apache Modules, enable mod_remoteip, then Review and Provision. From SSH: dnf install ea-apache24-mod_remoteip.

2. Configure

In WHM, open Service Configuration › Apache Configuration › Include Editor, choose Pre Main Include for all versions, and add the header and the proxies you trust. For Cloudflare:

RemoteIPHeader CF-Connecting-IP
RemoteIPTrustedProxy 173.245.48.0/20
RemoteIPTrustedProxy 103.21.244.0/22
# add every range from Cloudflare's published IP list (IPv4 and IPv6)

For a proxy that sends X-Forwarded-For, use RemoteIPHeader X-Forwarded-For and RemoteIPInternalProxy with the proxy's address. Save; Apache restarts.

3. Check

Visit your site and check the access log (/etc/apache2/logs/domlogs/): it should show your own IP, not the proxy's. Make sure the log format uses %a (client IP) rather than %h.

Note: Only list proxies you trust. If any address may set the header, visitors can fake their IP. Keep the Cloudflare list up to date when Cloudflare changes it.

Related services

Managed cPanel VPS

cPanel included; we handle updates, security and monitoring.

cPanel server management

hardening, migrations and 24/7 monitoring, with no long-term contract.

cPanel, Plesk and LiteSpeed licences

for VPS and dedicated servers, with installation help on demand.

Was this answer helpful?

Still stuck? Open a ticket