Skip to main content

Cloudflare Tunnel guide

When to use it

Cloudflare Tunnel publishes PlexSub without opening inbound ports directly to your server. It exposes your public HTTPS domain to the local Docker application.

Expected PlexSub configuration

VariableRecommended value
APP_BASE_URLFinal public HTTPS URL.
TRUST_PROXY_LEVEL1 when Cloudflare Tunnel is the trusted proxy in front of PlexSub.
FORCE_SECURE_COOKIES1.

Do not enable PLEXSUB_ALLOW_PRIVATE_TARGETS merely because you use Cloudflare Tunnel; it has a different purpose and affects internal-target security.

General flow

  1. Configure a domain in Cloudflare.
  2. Create a tunnel to the Docker server.
  3. Point the public hostname to http://localhost:5000 or the locally published Compose port.
  4. Set APP_BASE_URL to the public URL.
  5. Restart the app.
  6. Test sign-in in a private window.

Public demo

The demo compose binds by default to:

127.0.0.1:${DEMO_PORT:-5001}:5000

This works well with Cloudflare Tunnel: the demo is reachable locally by the tunnel but is not published across every host interface.

Common issues

SymptomLikely causeResolution
Login does not persistIncorrect cookie/proxy settingsCheck APP_BASE_URL, TRUST_PROXY_LEVEL, and HTTPS.
Unexpected redirectsPublic URL does not matchCorrect APP_BASE_URL.
Error 502Tunnel cannot reach local portCheck the published port and container status.
Works locally but not externallyIncomplete DNS/tunnel setupCheck the hostname in Cloudflare.