Running Hudu on a self-hosted server offers flexibility and control, but it also introduces potential exposure if your instance is accessible directly over the internet.
By placing Hudu behind Cloudflare Zero Trust, you can restrict access to authorized users and enforce identity-based authentication.
This guide walks through how to secure your Hudu deployment using Cloudflare Access, how to configure bypass and allow routes based on Hudu's endpoints, and how to keep Cloudflare's bot protection from blocking the integrations and AI clients that rely on those endpoints.
Prerequisites
Before you begin, ensure you have:
- A running self-hosted Hudu instance
- A domain or subdomain (e.g. docs.yourcompany.com) managed by Cloudflare
- Access to the Cloudflare Zero Trust dashboard (https://one.dash.cloudflare.com)
- Admin privileges for Hudu and Cloudflare
How Cloudflare Zero Trust works
Cloudflare Zero Trust (Access) functions as an identity-aware proxy that:
- Intercepts requests to your protected domain.
- Authenticates users through identity providers (Google Workspace, Microsoft Entra ID, Okta, etc.).
- Applies allow and bypass policies based on specific hostnames and paths.
- Forwards allowed traffic to your origin server (your Hudu instance).
Access only protects traffic that passes through Cloudflare. If your server's IP address is reachable directly from the internet, requests sent straight to that IP skip Access entirely. To close that gap, connect Hudu to Cloudflare with a Cloudflare Tunnel so your server isn't exposed directly. See Self-Hosted: Installing Hudu behind Cloudflare Zero Trust Tunnel for tunnel setup.
Setting up Cloudflare Access for Hudu
Step 1. Add an application
In the Cloudflare Zero Trust dashboard:
- Navigate to Access controls → Applications and select Add an application.
- Choose Self-hosted (labeled Self-hosted and private in newer versions of the dashboard).
- Give it a name, e.g. Hudu Docs.
- Add a public hostname set to your Hudu URL, e.g. docs.yourcompany.com.
Step 2. Define an access policy
Next, define who can access the application.
Example policy:
- Include: Emails ending in @yourcompany.com
- Require: Login through your identity provider
- Exclude: (Optional) Service accounts or testing groups
Configuring bypass and allow routes
Some Hudu paths need to remain unrestricted (bypassed) so the application works correctly, particularly for sharing, manifests, integrations, the mobile app, and AI clients.
Below are the recommended configurations for the main application:
| Application URL | Policy type |
|---|---|
/ |
Allow: assign to your authenticated group |
/manifest.json |
Bypass: required for PWA and browser compatibility |
/secure_notes, /shared, /otp_shared_access, /shared_article, /shared_process, /shared_file, /shared_photo
|
Bypass: allows access to publicly shared content; doesn't take up a license |
/public_photo |
Bypass: allows access to view uploaded photos |
/uploads/account/1/logo/* |
Bypass: displays your account logo on publicly shared pages. The 1 is the account ID and is usually 1 on self-hosted instances; if logos still fail to load, copy the path from a logo URL in your browser. |
/uploads/account/1/shared_logo/* |
Bypass: required only if a Shared Resource Logo is set under Admin → Design, since shared pages use that logo instead |
/app_assets |
Bypass: static assets such as JS and CSS |
/api/v1 |
Bypass or Allow: depends on your integration setup |
/uploads as a whole. This directory also stores company logos and file attachments, so bypassing it would make those files reachable without authentication. Keep logo bypasses scoped to the specific paths listed above.
For external apps, extensions, and the mobile app:
| Application URL | Policy type |
|---|---|
/jwt/refresh |
Bypass: token refresh requests |
/external_apps/* |
Bypass: recommended for the mobile app, browser extension, and other external apps (covers auth, sessions, and resource endpoints) |
/oauth/* |
Bypass: required for mobile app authentication (iOS and Android) and MCP client authentication |
/photo/* |
Bypass: required for photo display in the mobile app |
The /oauth/* and /photo/* endpoints are required for the Hudu mobile app on iOS and Android. Without /oauth/*, the app will return a "Session expired" error on sign-in. Without /photo/*, photos will not display in the app. After adding the /photo/* bypass, users must uninstall and reinstall the mobile app to clear the existing image cache.
/external_apps/* bypass and create Bypass applications only for the paths your tools actually call. A partial list is not enough on its own: you must also bypass auth-related paths such as /external_apps/sessions, /external_apps/auth/*, and /external_apps/me, plus any resource paths those tools use (for example /external_apps/companies, /external_apps/passwords, /external_apps/vault_passwords, /external_apps/password_folders, /external_apps/articles, /external_apps/article_folders, /external_apps/pins, and /external_apps/styles).
For the Hudu MCP server and AI clients:
| Application URL | Policy type |
|---|---|
/.well-known/* |
Bypass: lets MCP clients discover Hudu's OAuth settings before signing in |
/api/oauth/* |
Bypass: lets MCP clients register at the canonical /api/oauth/register endpoint |
/register |
Bypass: required for Claude, ChatGPT, and Gemini MCP connectors, which POST to /register at the issuer root instead of only using /api/oauth/register
|
/oauth/* |
Bypass: authorization and token requests (also listed above for the mobile app) |
/mcp |
Bypass: MCP Streamable HTTP endpoint used after OAuth; AI clients cannot complete an interactive Cloudflare Access sign-in for tool calls |
MCP clients can't complete an interactive Cloudflare Access sign-in, so these paths must be bypassed for AI clients to authenticate with Hudu and call the MCP server. Hudu still enforces OAuth and MCP permissions on these endpoints.
Visit Hudu MCP Server for additional information on connecting AI clients.
Building the rules in Cloudflare
In Cloudflare Zero Trust → Access controls → Applications:
- Select Add an application → Self-hosted.
- Add a public hostname set to your Hudu domain (e.g. docs.yourcompany.com).
- Under Paths, define the specific endpoint, e.g.
/manifest.json. - Create a policy with the action set to Bypass and the include rule set to Everyone.
- Save and repeat for each additional path that requires a bypass.
Keep your bypass routes narrowly scoped, such as /manifest.json or /shared_article, to avoid exposing unnecessary parts of your Hudu instance. A path application covers that path and its child paths (for example, /shared covers /shared/:id).
Cloudflare bot protection and WAF rules
Access bypass policies only apply to Cloudflare Access. Cloudflare's bot and security features, such as Bot Fight Mode, Super Bot Fight Mode, Browser Integrity Check, and WAF challenge rules, run separately and can still challenge or block requests to paths you've bypassed.
These challenges affect automated clients the most. MCP clients like Claude and ChatGPT can't complete JavaScript or CAPTCHA challenges, so the OAuth flow fails silently. Because the request is stopped at Cloudflare, no error appears in Hudu's logs. The paths most often affected are:
/.well-known/*/oauth/*/api/oauth/*/register/mcp
To keep these paths reachable:
- Super Bot Fight Mode (Pro, Business, and Enterprise plans): Create a WAF custom rule that matches the paths above and uses the Skip action for Super Bot Fight Mode.
- Bot Fight Mode (Free plan): Bot Fight Mode can't be skipped with WAF custom rules. Turn it off, or upgrade to a plan that includes Super Bot Fight Mode.
- Other WAF and challenge rules: Exempt the paths above from bot-challenge and WAF rules. The exact steps vary depending on your configuration.
If an AI client fails to connect and nothing appears in Hudu's logs, check Security Analytics in the Cloudflare dashboard for blocked requests to these paths.
Visit Cloudflare's Super Bot Fight Mode documentation for additional information on configuring skip rules.
How this works
Each application in Cloudflare Access corresponds to a domain or subdomain pattern (e.g. docs.yourcompany.com/manifest.json) and has its own policy. When a request matches that path, Cloudflare enforces the policy attached to it, whether it's Bypass, Allow, or Block. More-specific path applications take precedence over broader ones.
Because of this design, you'll create multiple Access applications for your Hudu instance:
- One for your main application (
/) - One for each bypass endpoint (like
/manifest.jsonor/shared_article) - One for any external app integrations
- One for MCP-related paths if you use AI clients
Securing your self-hosted Hudu instance behind Cloudflare Zero Trust strengthens access control while keeping the user experience seamless. By routing your domain through Cloudflare, creating distinct Access applications, applying precise Allow and Bypass policies, and exempting the right paths from bot protection, you keep Hudu protected without breaking external applications, AI clients, or shared content.
Visit Cloudflare's Access policy documentation for additional information on Access policies.