# Mattermost behind Cloudflare: lab findings and recommendations

**URL:** <https://forum.mattermost.com/t/mattermost-behind-cloudflare-lab-findings-and-recommendations/26322>\
**Category:** Recipes\
**Created:** [November 8, 2026, 10:56pm UTC](https://forum.mattermost.com/t/mattermost-behind-cloudflare-lab-findings-and-recommendations/26322 "2026-11-08T22:56:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stu-harvest](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/stu-harvest/32/9439_2.png) [@stu-harvest](https://forum.mattermost.com/u/stu-harvest)\
**Post date:** [November 8, 2026, 10:56pm UTC](https://forum.mattermost.com/t/mattermost-behind-cloudflare-lab-findings-and-recommendations/26322/1 "2026-11-08T22:56:08Z")

</div>

Hi all,

I set up Mattermost 11.11.4 behind Cloudflare (Free plan) in a throwaway AWS environment and, working with Claude Code, changed one setting at a time while testing the web, desktop and mobile clients. Each finding in the write-up is labelled as either a documented recommendation or a lab observation, with links to the Cloudflare and Mattermost docs.

The file is also written to be useful as context for an AI coding assistant: drop it into Claude Code alongside your own Terraform or server config and ask it to check your setup against it.

👉 [Running Mattermost behind Cloudflare: what I reproduced, and what the docs recommend · GitHub](https://gist.github.com/sadohert/8a037963d5739add30b9c0ec2c205908)

---

<div class="post-metadata">

**Author:** ![will](https://avatars.discourse-cdn.com/v4/letter/w/90ced4/32.png) [@will](https://forum.mattermost.com/u/will)\
**Post date:** [November 11, 2026, 1:06am UTC](https://forum.mattermost.com/t/mattermost-behind-cloudflare-lab-findings-and-recommendations/26322/2 "2026-11-11T01:06:08Z")

</div>

Running Mattermost behind Cloudflare works well, but there are two specific Cloudflare settings that trip people up on WebSocket connections:

1. **WebSocket Proxy & Timeout** :  
Under Cloudflare **Network** , make sure **WebSockets** is toggled **On**. Keep in mind that Cloudflare’s free/Pro tiers close idle WebSocket connections after **100 seconds**. In Mattermost `config.json`, set `ServiceSettings.WebsocketPingInterval` to `30` (or `60`) seconds so the server/client keeps the TCP stream warm and prevents random reconnection drops in desktop/mobile apps.
2. **Real Client IP Logging** :  
Cloudflare proxies hide the real user IP unless your upstream reverse proxy (Nginx or Caddy in front of Mattermost) trusts Cloudflare’s IP ranges:

```nginx
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.21.244.0/22;
# ... add full Cloudflare IP list
real_ip_header CF-Connecting-IP;

```

Without this, Mattermost audit logs and rate limiters will see Cloudflare edge IPs and could throttle all team members at once during high-activity hours.
